Posted by Harlan Messinger on 10/26/07 15:17
SaraLeePerson@gmail.com wrote:
> <form name=theform>
> <textarea onkeydown="whynowork()" ID="inputbox" cols=25 rows=5></
> textarea>
> </form>
>
> <div id=divtag></div>
>
> <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. How can I
> rectify this problem? :-)
Because there isn't a character until the key has come back up and the
key press has been registered. If you type more than one character, the
display in the divtag div should be one character behind each time. Use
onkeypress.
Navigation:
[Reply to this message]
|