Mega Code Archive

 
Categories / JavaScript DHTML / Form Control
 

Return the name of the form that contains dropdown list (combobox)

<html> <head> <script type="text/javascript"> function formAction(){     var x=document.getElementById("mySelect")     alert(x.form.name) } </script> </head> <body> <form name="myForm">     <select id="mySelect">         <option>Apple</option>         <option>Banana</option>         <option>Orange</option>     </select>     <input type="button" onclick="formAction()" value="Show name of the form"> </form> </body> </html>