Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

<html> <head><title>formularios - Otros formularios - ejemplo 1</title> <script language="JavaScript" type="text/javascript"><!-ns4 = (document.layers)? true:false ie4 = (document.all)?

true:false function sendForm() { // target forms mainf = document.mainForm namef = (ns4) ? document.nameLyr.document.nameForm : document.nameForm agef = (ns4) ? document.ageLyr.document.ageForm : document.ageForm genderf = (ns4) ? document.genderLyr.document.genderForm : document.gend erForm marriedf = (ns4) ? document.marriedLyr.document.marriedForm : document.m arriedForm continentf = (ns4) ? document.continentLyr.document.continentForm : docu ment.continentForm commentsf = (ns4) ? document.commentsLyr.document.commentsForm : documen t.commentsForm // glue data mainf.name.value = namef.name.value mainf.age.value = agef.age.value mainf.gender.value = (genderf.gender[0].checked) ? genderf.gender[0].val ue : genderf.gender[1].value mainf.married.value = (marriedf.married.checked) ? "happily" : "not" mainf.continent.value = continentf.continent.options[continentf.continen t.selectedIndex].value mainf.comments.value = commentsf.comments.value // submit form mainf.su bmit() } // swap fields function swap(hideobj,showobj) { hidenon(hideobj) shownon(showobj) } // Show/Hide functions for non-pointer layer/objects function shownon(showobj) { if (ns4) document.layers[showobj].visibility = "show" else if (ie4) document.all[showobj].style.visibility = "visible" } function hidenon(hideobj) { if (ns4) document.layers[hideobj].visibility = "hide" else if (ie4) document.all[hideobj].style.visibility = "hidden" } //--> </SCRIPT> <STYLE TYPE="text/css"> <!-#nameLyr {position:absolute; left:100; top:20; width:200; visibility:visible;} #ageLyr {position:absolute; left:100; top:20; width:200; visibility:hidden;} #genderLyr {position:absolute; left:100; top:20; width:200; visibility:hidden;} #marriedLyr {position:absolute; left:100; top:20; width:200; visibility:hidden;} #continentLyr {position:absolute; left:100; top:20; width:200; visibility:hidden ;}

#commentsLyr {position:absolute; left:100; top:20; width:200; visibility:hidden; }--></STYLE></HEAD> <BODY> <center> <FORM NAME="mainForm" ACTION="" METHOD="POST"> <INPUT TYPE="Hidden" NAME="name"> <INPUT TYPE="Hidden" NAME="age"> <INPUT TYPE="Hidden" NAME="gender"> <INPUT TYPE="Hidden" NAME="married"> <INPUT TYPE="Hidden" NAME="continent"> <INPUT TYPE="Hidden" NAME="comments"> </FORM> <DIV ID="nameLyr"> <FORM NAME="nameForm">Nombre: <BR><INPUT TYPE="Text" NAME="name" SIZE="20"></FORM> <P><A HREF="javascript:swap('nameLyr','ageLyr')">Siguiente</A> </DIV> <DIV ID="ageLyr"> <FORM NAME="ageForm">Edad: <BR><INPUT TYPE="Text" NAME="age" SIZE="3"></FORM> <P><A HREF="javascript:swap('ageLyr','genderLyr')">Siguiente</A> </DIV> <DIV ID="genderLyr"> <FORM NAME="genderForm">Sexo: <BR><INPUT TYPE="Radio" NAME="gender" VALUE="male">Hombre <BR><INPUT TYPE="Radio" NAME="gender" VALUE="female">Mujer</FORM> <P><A HREF="javascript:swap('genderLyr','marriedLyr')">Siguiente</A> </DIV> <DIV ID="marriedLyr"> <FORM NAME="marriedForm">Estado civil: <BR><INPUT TYPE="Checkbox" NAME="married"> (check si est&aacute; casado)</FORM> <P><A HREF="javascript:swap('marriedLyr','continentLyr')">Siguiente</A> </DIV> <DIV ID="continentLyr"> <FORM NAME="continentForm">Continente: <BR><SELECT NAME="continent"> <OPTION VALUE="North America">Norte Am&eacute;rica</OPTION> <OPTION VALUE="South America">Am&eacute;rica del Sur</OPTION> <OPTION VALUE="Europe">Europa</OPTION> <OPTION VALUE="Africa">Africa</OPTION> <OPTION VALUE="Asia">Asia</OPTION> <OPTION VALUE="Australia">Australia</OPTION> <OPTION VALUE="Antarctica">Antartida</OPTION> </SELECT></FORM> <P><A HREF="javascript:swap('continentLyr','commentsLyr')">Siguiente</A> </DIV> <DIV ID="commentsLyr"> <FORM NAME="commentsForm">Comentarios: <BR><TEXTAREA NAME="comments" ROWS="3" COLS="30" WRAP="PHYSICAL"></TEXTAREA></FO RM> <P><A HREF="javascript:sendForm()">Enviar datos</A> </DIV> </BODY> </HTML>

You might also like