Mega Code Archive

 
Categories / JavaScript DHTML / Form Control
 

Dropdown list (combobox) in a form

<html> <head> <script type="text/javascript"> function put(){     txt=document.forms[0].myList.options[document.forms[0].myList.selectedIndex].text     document.forms[0].favorite.value=txt } </script> </head> <body> <form> Select your favorite browser: <select name="myList" onchange="put()">   <option>Internet Explorer</option>   <option>Netscape</option>   <option>Opera</option> </select> <br><br> Your favorite browser is: <input type="text" name="favorite" size="20"> </form> </body> </html>