syedali77
04-27-2004, 02:22 PM
There ia an empty textarea and a pre-populated drop-down box with a default message. How can I get the text selected from the drop-down box(onChange) into the textarea using javascript?
|
||||
Populating textarea when dropdown box is changedsyedali77 04-27-2004, 02:22 PM There ia an empty textarea and a pre-populated drop-down box with a default message. How can I get the text selected from the drop-down box(onChange) into the textarea using javascript? swmr 04-27-2004, 02:53 PM this might do it... <html> <head> <title>-</title> <script type="text/JavaScript"> function showText(){ var F, opt; F = document.oForm; opt = F.oSel.options; F.oTxt.value = opt[opt.selectedIndex].text; } </script> </head> <body> <form name="oForm"> <select name="oSel" size="3" onchange="showText()"> <option>lorem</option> <option>ipsum</option> <option>dolar</option> </select> <textarea name="oTxt" cols="10" rows="5"> </textarea> </form> </body> </html> glenngv 04-28-2004, 04:43 AM shorter code: <select name="oSel" size="3" onchange="this.form.oTxt.value=this.options[this.selectedIndex].text"> |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum