<html> <head> <script type="text/javascript"> function formAction() { var x=document.getElementById("mySelect") alert(x.length) } </script> </head> <body> <form> <select id="mySelect"> <option>Apple</option> <option>Banana</option> <option>Orange</option> </select> <input type="button" onclick="formAction()" value="How many options in the list?"> </form> </body> </html>
Edit the text above, and click on the button to see the result.
Copyright © 2007-2008, Www.JavaBasics.We.Bs All rights reserved.