action 属性可设置或返回表单的 action 属性。
action 属性定义了当表单被提交时数据被送往何处。
formObject.action=URL
下面的例子可更改表单的 action URL:
<html> <head> <script type="text/javascript"> function changeAction() { var x=document.getElementById("myForm") alert("Original action: " +x.action
)x.action="index.asp"
alert("New action: " +x.action
) x.submit() } </script> </head> <body> <form id="myForm" action="js_examples.asp"> Name: <input type="text" value="Mickey Mouse" /> <input type="button" onclick="changeAction()" value="Change action attribute and submit form" /> </form> </body> </html>