|
Posted by Doug Miller on 10/26/07 15:52
In article <1193408017.649249.158790@y42g2000hsy.googlegroups.com>, SaraLeePerson@gmail.com wrote:
><form name=theform>
name="theform"
><textarea onkeydown
onKeyDown
>="whynowork()" ID="inputbox" cols=25 rows=5></
>textarea>
></form>
>
><div id=divtag></div>
id="divtag"
>
><script>
>function whynowork(){
>document.getElementById("divtag").innerHTML =
>document.forms['theform'].elements['inputbox'].value
>}
></script>
>
>Hello
>Can someone please explain what I am doing wrong here? When you enter
>something into the textarea, it skips the first character.
As you can easily see by typing 12345 in the textarea, it's not the *first*
character that fails to display. Go slowly, and observe when each character
appears.
Observe what happens when you type 123<backspace>4<shift>.
That should be instructive. :-)
> How can I
>rectify this problem? :-)
Consider the sequence of events that occurs when a key is pressed, then
evaluate whether onKeyDown is the event handler you're really interested in,
or if another one might be more appropriate. <g>
--
Regards,
Doug Miller (alphageek at milmac dot com)
It's time to throw all their damned tea in the harbor again.
Navigation:
[Reply to this message]
|