title: How to fire Javascript event when user drags text into textfield?
body: <p>I have a form that formats text which is inputed by several textfields, and I would like to make it possible for the user to type text, paste text, and drop text into the textfield. The javascript event is <code>format()</code>. <br/><br/>I have used the <code>onkeyup="format()</code> when a user types text and pastes text, but I can't figure out what event will allow a user to select text, drag and drop it over the textfield, and fire the event to automatically update the formatted text. I have tried <code>ondrop</code>, <code>onmouseup</code>, and <code>onchange</code> all to no avail. <br/><br/>I have a feeling that the <code>onmouseup</code> property is working, but the problem is that the event fires right after the mouse is released, before the text textfield has the new user text, so it looks as if it didn't fire, when indeed it did, but there was nothing in the textfield. Could this be? If so, could I use <code>setTimeout</code> to delay the event by 500 milliseconds (or something) until the text is there?<br/><br/></p>
  
  <p>Here is the javscript:</p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  function format() {
       var author = document.form.author.value;
       var credentials = document.form.credentials.value;
       var date = document.form.date.value;
       var publication = document.form.publication.value;
       var title = document.form.title.value;
       var evidence = document.form.evidence.value;
       var tagline = document.form.tagline.value;
       document.getElementById('txtarea').innerHTML = ("&lt;b&gt;" + tagline + "&lt;/b&gt;" + "&lt;/br &gt;" + "&lt;br /&gt;" + "&lt;i&gt;" + "&lt;u&gt;" + author + " " + date + "." + "&lt;/u&gt; " + author + " (" + credentials + ") " + date + " " + publication + " " + title + " " + (window.top.getBrowser().selectedBrowser.contentWindow.location.href) + "&lt;/i&gt;" + "&lt;br /&gt;" + "&lt;br /&gt;" + evidence);}
  function clearForm() {
       document.getElementById('txtarea').innerHTML = "";
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Here is one of the 7 textfields that I have (I have the onkeyup which covers type and paste, but I don't know what to use for drag and drop):</p>
  
  <pre><code>&lt;form class="right_aligned" name="form" method="get" action="" id="form"   onkeyup="format()" onmouseup="format()" ondrop="format()"&gt;
  
  &lt;div style="float: left;"&gt;&lt;input ondblclick="this.value=''" type="text" name="publication" value="Publication..." id="publication" style="border:1px solid;border-color:#B0B0B0;width:225px;padding:4px;margin:10px;color: #000;"  
  ondrop="format()" ondragover="{this.value=''; this.style.color='#000';}" onfocus="if (this.value==this.defaultValue) {this.value=''; this.style.color='#000';}"  onblur="if(this.value=='') {this.value=this.defaultValue; this.style.color='#000';}"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>...and here is the contenteditable div that the text is outputted to:</p>
  
  <pre><code>&lt;div CONTENTEDITABLE id="txtarea" ondblclick="document.execCommand('selectAll',false,null);" style="float:left;overflow:auto;padding:5px;background-color:#FFF;border:1px solid;border-color:#B0B0B0;outline:none;width:213px;height:260px;font-size:.75em;margin-left:10px;margin-right:10px;margin-bottom:10px;margin-top:5px" type="text"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>By the way, this is for a Firefox extension, so cross browser is not an issue. It just has to work in Firefox. </p>