You are here: Re: Why does this not fully work? <Textarea> + DIV + InnerHTML « HTML « IT news, forums, messages
Re: Why does this not fully work? <Textarea> + DIV + InnerHTML

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация