查找表单的 action 属性

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function changeAction()
  5. {
  6. var x=document.getElementById("myForm")
  7. alert("Original action: " + x.action)
  8. x.action="/htmldom/index.asp"
  9. alert("New action: " + x.action)
  10. x.submit()
  11. }
  12. </script>
  13. </head>
  14. <body>
  15.  
  16. <form id="myForm" action="/i/eg_smile.gif">
  17. 名称:<input type="text" value="米老鼠" />
  18. <input type="button" onclick="changeAction()"
  19. value="改变 action 属性并提交表单" />
  20. </form>
  21.  
  22. </body>
  23. </html>