Form actionProperty
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
![]()
![]()
![]()
![]()
![]()
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>
<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 Object Other Extensions