onsubmit

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function confirmInput()
  5. {
  6. fname=document.forms[0].fname.value
  7. alert("您好 " + fname + "!您会被重定向到 www.jishuchi.com")
  8. }
  9. </script>
  10. </head>
  11.  
  12. <body>
  13. <form onsubmit="confirmInput()" action="http://www.jishuchi.com/">
  14. 请输入您的名字:<input id="fname" type="text" size="20">
  15. <input type="submit">
  16. </form>
  17. </body>
  18.  
  19. </html>