Form actionProperty

Form 对象参考手册Form Object

Definition and Usage

The action property sets or returns the value of the action attribute of a form.

The action attribute defines where the data is sent when the form is submitted.

Syntax

formObject.action=URL


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the action attribute


Example

Example

Return the URL of the form submission:

<html>
<body>

<form id="frm1" action="form_action.html">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br>
<input type="submit" value="Submit">
</form>

<script>
document.write(document.getElementById("frm1").action);
</script>

</body>
</html>

The output of the above example is:

form_action.html

Try it yourself »


Form 对象参考手册Form Object Other Extensions