Change value of textarea when hovering link

Posted by hellfyr on Stack Overflow See other posts from Stack Overflow or by hellfyr
Published on 2011-01-16T02:44:33Z Indexed on 2011/01/16 2:53 UTC
Read the original article Hit count: 153

Filed under:
|

I would like to change the value of a textarea when hovering over a link. I am not very proficient at javascript and do not quite understand the intricacies of 'this.' and 'document.' etc..

Currently I have a textarea 'info' that on page load is unpopulated and two links that should change its value. I can not seem to get it to work..

<textarea name="info"></textarea>
<a href="foo.com" onmouseover="document.info.value='foo.com is a great site'">Foo.com</a>
<a href="bar.com" onmouseover="document.info.value='bar.com is a terrible site'">Bar.com</a>

I'm sure there is a way to accomplish what I need to do but I can't find it.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html