Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/09/2008, 07:31
jcouoh
 
Fecha de Ingreso: septiembre-2003
Ubicación: Merida, yucatan
Mensajes: 282
Antigüedad: 21 años, 6 meses
Puntos: 1
No me funciona pasar valores entre ventanas

HOla nuevamente,

Tengo dos paginas una padre y una popup, como es natural quiero pasar los valores del popup a la ventana principal y quise hacer a traves del javascript pero no me dio resultado, regreso aqui pues he visto lo persistentes que son y su conocimiento en esta area del javascript la cual todavia me da mucho trabajo.

voy a ponerles los codigos de ambas ventanas con la esperanza de que aqui puedan encontrar el error que tengo:

Ventana principal:
Código HTML:
<html><head></head><body>


<form name="frm" id="frm">

<input type=text id="GtoFecha"><br>
<input type=text id="GtoLocalidad"><br>
<input type=text id="GtoFacturaNo"><br>
<input type=text id="GtoCantidad"><br>
<input type=text id="GtoConcepto"><br>
<input type=text id="GtoPrecioUnit"><br>
<input type=text id="GtoImporte"><br>
<input type=text id="GtoPrecioTotal"><br>
<input type=text id="GtoResponsable"><br>
<input type=text id="GtoAuthor"><br>

</form>



<a href="#" title="" onClick="window.open('003.html')" 

width="400" height="200">Gastos</a>



</body></html> 

ventana popup: Nota no quiero usar el boton enviar por el asunto que lo que necesito es pasar los valores a la ventana principal. solo esta puesto por referencia o prueba. Además en la ventana popup se craan dinamicamente nuevas columans de campos los cuales estan bien. yo despues agrego los campos faltantes en la ventana principal.


Código HTML:
<html>
<head>
<title></title>
<style type="text/css">

.input1
{

width:80;

}

.input2
{
BORDER-RIGHT: #336699 1px solid;
BORDER-TOP: #336699 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #336699 1px solid;
WIDTH: 120;
COLOR: #000000;
BORDER-BOTTOM: #336699 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
BACKGROUND-COLOR: #ffffff
}


.input3
{
BORDER-RIGHT: #336699 1px solid;
BORDER-TOP: #336699 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #336699 1px solid;
display:block;
width:100%;
COLOR: #000000;
BORDER-BOTTOM: #336699 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
BACKGROUND-COLOR: #679BD0
}
.input4
{
BORDER-RIGHT: #336699 1px solid;
BORDER-TOP: #336699 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #336699 1px solid;
display:block;
width:100%;
COLOR: #000000;
BORDER-BOTTOM: #336699 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
BACKGROUND-COLOR: #679BD0
}
.input5
{
BORDER-RIGHT: #336699 1px solid;
BORDER-TOP: #336699 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #336699 1px solid;
display:block;
width:40;
COLOR: #000000;
BORDER-BOTTOM: #336699 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
BACKGROUND-COLOR: #679BD0
}

.td
{

FONT-SIZE: 12px;
font-family:verdana;
height:22;

}
#iframe
    {
    overflow:auto;
    width:300px;
    height:100px;
    }
</style>
</head>
<body>


<table width=2000> <tr><td width=110 height=50>

<table>
<tr><td class="td" align=right>Fecha:</td></tr>
<tr><td class="td" align=right>Localidad:</td></tr>
<tr><td class="td" align=right>Factura No.:</td></tr>
<tr><td class="td" align=right>Cantidad:</td></tr>
<tr><td class="td" align=right>Concepto:</td></tr>
<tr><td class="td" align=right>Precio Unitario:</td></tr>
<tr><td class="td" align=right>Importe:</td></tr>
<tr><td class="td" align=right>Precio Total:</td></tr>
<tr><td class="td" align=right>Responsable:</td></tr>
<tr><td class="td" align=right>Atorizó:</td></tr>


</table></td><td>
<form id="myform" name="myform" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">

<div id="bloque" style="float:left; width:80px; ">
<table width="80"><tr><td>

<input type=text class=input1
name="GtoFecha[]"
value="">

<input type=text class=input1
name="GtoLocalidad[]"
value="">


<input type=text class=input1
name="GtoFacturaNo[]"
value="">

<input type=text class=input1
name="GtoCantidad[]"
value="">

<input type=text class=input1
name="GtoConcepto[]"
value="">

<input type=text class=input1
name="GtoPrecioUnit[]"
value="">

<input type=text class=input1
name="GtoImporte[]"
value="">

<input type=text class=input1
name="GtoPrecioTotal[]"
value="">

<input type=text class=input1
name="GtoResponsable[]"
value="">

<input type=text class=input1
name="GtoAuthor[]"
value="">

</td></tr>

</table>
</div>


</form>

</td></tr></table>
<form><div style="clear:both; padding-top:15px"><button type="button" onClick="doIt()">Gasto Nuevo</button>
    <br>
    <br>
<input name="e" type="button" id="e" value="Enviar" onclick="document.getElementById('myform').submit()">
</div></form>
<script>
function doIt()
{
var f = document.getElementById('myform');

var b = document.getElementById('bloque');
var b2=b.cloneNode(true)
f.appendChild(b2);
}

</script>

<?php
if(isset($_POST) && !empty($_POST)){
echo '<pre>';
print_r($_POST);
echo '<pre>';
}
?>


<a href="JavaScript:close();" title="pasar valor" onClick="
window.opener.document.frm.GtoFecha.value = window.document.myform.GtoFecha[0].value;
window.opener.document.frm.GtoLocalidad.value = window.document.myform.GtoLocalidad.value;
window.opener.document.frm.GtoFacturaNo.value = window.document.myform.GtoFacturaNo.value;
window.opener.document.frm.GtoCantidad.value = window.document.myform.GtoCantidad.value;
window.opener.document.frm.GtoConcepto.value = window.document.myform.GtoConcepto.value;
window.opener.document.frm.GtoPrecioUnit.value = window.document.myform.GtoPrecioUnit.value;
window.opener.document.frm.GtoImporte.value = window.document.myform.GtoImporte.value;
window.opener.document.frm.GtoPrecioTotal.value = window.document.myform.GtoPrecioTotal.value;
window.opener.document.frm.GtoREsponsable.value = window.document.myform.GtoREsponsable.value;
window.opener.document.frm.GtoAuthor.value = window.document.myform.GtoAuthor.value;
">Regresar a la Ventana Principal</a>

</body>
</html>