Programación Web y Scripting > HTML
paso de parametros a dos archivos html
nostromo:
Hola;
Les tengo el mismo pero con mejoras, ahora, desde los form hijo le paso parametros al form padre.
Maestro.html
--- Código: Text --- <html><head><title></title><script>var parametro;var parametro2;function abrircopia(){ parametro = window.open("copia.html","","width=400,height=300"); parametro2 = window.open("copia2.html","","width=400,height=300"); //pasar();}function pasar(){ var men; var men_1 = document.formul.valor.value; //men = ""; if(document.formul.valor.value !="") { men = "<table border=0 cellspacing=0 cellpadding=0 class=texto>"; men += "<tr><td>Item</td><td>Detalle</td></tr>"; men += "<tr><td>1</td><td>Moneda</td></tr>"; men += "<tr><td>2</td><td>Silla</td></tr>"; men += "</table>" parametro.document.all.aqui.innerHTML=men; parametro2.document.all.aqui2.innerHTML="Colocar otros datos"; parametro2.document.all.aqui3.innerHTML=men_1; //------------------------------- with(document.formul.valor) { value=""; focus(); } }}</script><style>body {font-family:verdana;font-size:12px;cursor:default;}</style></head><body><form name=formul> <input type=button value=Abrir onclick=abrircopia();> <input type=text name=valor size=10> <input type=button value=Paso onclick=pasar();> <br> Parametros de la Ventana 1 <input type=text size=20 name=resul_1 readonly> <br> Parametros de la Ventana 2 <input type=text size=20 name=resul_2 readonly></form></body></html>
copia.html; pasa información al padre y luego se cierra.
--- Código: Text --- <html><head><title>Prueba 1</title><style>body {font-family:verdana;font-size:12px;}.texto{font-family:verdna;font-size:12px;}</style><script>function renviar(){ var datos = document.formulario.valores.value; var pat = opener.document.formul; if(document.formulario.valores.value != "") { with(pat) { resul_1.value = datos } //--- cerrar ventana actual--- window.close(); }}</script></head><body ><form name=formulario> <input type=text size=15 name=valores> <input type=button value=Reenviar onclick=renviar(); name=boton></form><span id=aqui></span></body></html>
copia2.html; pasa los datos al padre y le coloca el foco.
--- Código: Text --- <html><head><title>Prueba 2</title><style>body {font-family:verdana;font-size:12px;}.texto{font-family:verdna;font-size:12px;}</style><script>function renviar(){ var datos = document.formi.factor.value; var pat = opener.document.formul; if(document.formi.factor.value != "") { with(pat) { resul_2.value = datos; opener.focus(); } }}</script></head><body><form name=formi> <input type=text size=15 name=factor> <input type=button value=Reenviar name=botin onclick=renviar();></form><span id=aqui2></span><br><span id=aqui3></span></body></html>
Espero que lo disfruten.
Nos vemos.
Navegación
[*] Página Anterior
Ir a la versión completa