onchange

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function preferedBrowser()
  5. {
  6. prefer=document.forms[0].browsers.value
  7. alert("您浏览器互联网时喜欢使用 " + prefer)
  8. }
  9. </script>
  10. </head>
  11.  
  12. <body>
  13.  
  14. <form>
  15. 请选择您喜欢的浏览器:
  16. <select id="browsers" onchange="preferedBrowser()">
  17. <option value="Internet Explorer">Internet Explorer
  18. <option value="Netscape">Netscape
  19. </select>
  20. </form>
  21.  
  22. </body>
  23. </html>