/

HTML / CSS / JavaScript Tutorial

HTML Standard attribute: action

[this page | pdf | back links]

The HTML action attribute indicates where to send form-data for a <form> element when the form is submitted.

 

Valid attribute values (when used with a <form> element) include:

 

Value

Description

URL

Where to send the form-data when form is submitted

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<form action="http://www.nematrian.com/ExpressionEvaluator.aspx">
<input type="radio" name="expr" value="3*5">3*5</input><br>
<input checked type="radio" name="expr" value="5*exp(1)*max((1,2,3))">5*exp(1)*max((1,2,3))</input><br>
<input type="submit" value="Go to webpage to evaluate">
</form>

<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var f = document.createElement("FORM");
f.setAttribute("action","http://www.nematrian.com/ExpressionEvaluator.aspx");
var x1 = document.createElement("INPUT");
x1.setAttribute("type","radio");
x1.setAttribute("name","expr");
x1.setAttribute("value","3*5");
var txt1 = document.createTextNode("3*5");
var x2 = document.createElement("BR");
var x3 = document.createElement("INPUT");
x3.setAttribute("type","radio");
x3.setAttribute("checked","checked");
x3.setAttribute("name","expr");
x3.setAttribute("value","5*exp(1)*max((1,2,3))");
var txt3 = document.createTextNode("5*exp(1)*max((1,2,3))");
var x4 = document.createElement("BR");
var x5 = document.createElement("INPUT");
x5.setAttribute("type","submit");
x5.setAttribute("value","Go to webpage to evaluate");
f.appendChild(x1);
f.appendChild(txt1);
f.appendChild(x2);
f.appendChild(x3);
f.appendChild(txt3);
f.appendChild(x4);
f.appendChild(x5);
document.getElementById("element").appendChild(f);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile