Form actionPropiedad
Objeto Form
Definición y uso
La propiedad action puede establecer o devolver el atributo action de un formulario.
El atributo action define a dónde se envían los datos cuando se envía un formulario.
Sintaxis
formObject.action=URL
Compatibilidad del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten el atributo action.
Ejemplo
Ejemplo
Devuelve la URL de envío del formulario:
<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>
Resultado del ejemplo anterior:
form_action.html
Pruébalo »
Objeto Form Otras extensiones