Multiples acciones en un formulario
Código Javascript
- Por Programador ASP clásico /
- 01/03/2012 @ 09:28:58 /
- 1007 visitas
En primer lugar creamos el formulario con los botones que ejecutarán las acciones:
<form name="Form1" method="post">
<input type="text" name="text1" size="10" />
<INPUT type="button" value="Button1" name=button1 onclick="return OnButton1();">
<INPUT type="button" value="Button2" name=button2 onclick="return OnButton2();">
</form>
Enseguida generamos el código javascript para manejar los eventos:
<script language="Javascript">
function OnButton1() {
document.Form1.action = "Page1.aspx"
document.Form1.target = "_blank"; // Open in a new window
document.Form1.submit(); // Submit the page
return true; }
function OnButton2() {
document.Form1.action = "Page2.aspx"
document.Form1.target = "_blank"; // Open in a new window
document.Form1.submit(); // Submit the page
return true; }
</script>
<noscript>You need Javascript enabled for this to work</noscript>
tags: hacer un formulaio, como hacer un formulario, hacer un formulario html, hacer formulario html, acciones multiples, insertar formulario html, insertar formulario en html, codigo para hacer un formulario en html