Foros del Web » Programando para Internet » Javascript »

Problema Enviando Variable Desde Popup A Ventana Madre

Estas en el tema de Problema Enviando Variable Desde Popup A Ventana Madre en el foro de Javascript en Foros del Web. bueno agradeceria me den solucion a este problema que tengo: tengo 2 paginas una madre y una hija .....la madre tanto como la hija tiene ...
  #1 (permalink)  
Antiguo 03/04/2008, 11:23
 
Fecha de Ingreso: marzo-2008
Mensajes: 3
Antigüedad: 16 años, 1 mes
Puntos: 0
Problema Enviando Variable Desde Popup A Ventana Madre

bueno agradeceria me den solucion a este problema que tengo:
tengo 2 paginas una madre y una hija .....la madre tanto como la hija tiene 1 formulario, pero cuando intento enviar desde a esta primera pagina no lo envia ..he copiado el codigo lo pongo en otra pagina y funciona correctamente ..porfavor suplico ayuda es super urgente esta web ...ahi les mando los codigos:

pagina madre 1:

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
.hide {display: none}
</style>
<script type="text/javascript">
function hideDiv(){
tag = document.getElementsByTagName("div");
for(x=0;x<tag.length; x++){
if(tag[x].getAttribute('id').indexOf("choose_") != -1){
tag[x].style.display = "none";
}
}
}
function view(id){
ge = document.getElementById('choose_' + id.value);
hideDiv();
ge.style.display = "block";
}
</script>
<style type="text/css">
<!--
a img{
border:0;
}
.Estilo2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
}
body {
	background-image: url(../Images/fondo.jpg);
}
.Estilo4 {
	font-weight: bold;
	font-size: 14px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #FFFFFF;
}
-->
</style>
</head>

<body>
<table width="680" border="0" align="center" cellpadding="0" cellspacing="5" bordercolor="#006598" bgcolor="#006598">
  <tr>
    <td><img src="../Images/cp_Images/cabe.jpg" width="678" height="148" /></td>
  </tr>
  <tr>
    <td height="30" bgcolor="#004354">&nbsp;</td>
  </tr>
  <tr>
    <td><table width="535" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="446"><table width="442" border="0" cellpadding="0" cellspacing="8" bgcolor="#FFFFFF">
            <tr>
              <td height="70" colspan="4" background="../Images/cp_Images/cplogo.jpg">&nbsp;</td>
              </tr>
            <tr>
              <td height="25" colspan="4" bgcolor="#006598"> <img src="../Images/cp_Images/flecha.gif" width="12" height="15" /> <span class="Estilo4">Agregar un Item</span></td>
            </tr>
            <tr>
              <td height="50" colspan="4"><form>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="22%" class="Estilo2">ID:</td>
                    <td width="78%" height="30"><input type="text" name="textfield" id="textfield" />
                    </td>
                  </tr>
                  <tr>
                    <td class="Estilo2">Nombre:</td>
                    <td height="30"><input type="text" name="textfield2" id="textfield2"  /></td>
                  </tr>
                  <tr>
                    <td class="Estilo2">Nombre (ingles):</td>
                    <td height="30"><input type="text" name="textfield3" id="textfield3" />
                    </td>
                  </tr>
                  <tr>
                    <td class="Estilo2">Tipo:</td>
                    <td height="30"><strong>
                      <input type="radio" name="radio" value="a1" onclick="view(this)" />
                      Sub-Pagina      
                      <input type="radio" name="radio" value="a2" onclick="view(this)" />
                      Lista             
                      <input type="radio" name="radio" value="a3" onclick="view(this)" />
                      Link </strong> </td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td><div class="hide2" id="choose_a1"> <span class="Estilo2">
                    </span>
                        <input type="button" value="Abre PopUp" onClick="window.open('editor.htm','miventana','width=308,height=70,menubar=no');"><input type="text" name="contenido_es" id="contenido_es"/>
                    </div>
                        <div class="hide" id="choose_a2"><span class="Estilo2"> Ingresar Nombre de la Lista:<br />
                              <input name="link2" type="text" id="link2" size="30" />
                        </span></div>
                      <div class="hide" id="choose_a3">Direccion: http://
                        <input name="link" type="text" id="link" size="30" />
                      </div></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td><input type="submit" name="button" id="button" value="Enviar" /> <input type="button" name="button2" id="button2" value="Cancelar" /></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
                              </form>
                              <form>
  <span class="hide2"><span class="Estilo2">
  <input type="button" value="Editor" onClick="window.open('loco.htm','miventana','width=308,height=70,menubar=no');" />
  </span>
  <input type="text" name="t1" id="t1" />
  </span>
</form>
                </td>
              </tr>
            
        </table></td>
        <td width="233" bgcolor="#CCCCCC">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html> 
la hija:(popup)

Código HTML:
<html>
<head>
<script language="javascript"> 
function recuperaDato(){
 window.opener.document.all.contenido_es.value=document.all.Dato.value;
 if(confirm('Ha Terminado de Editar la Pagina Web\n¿Desea Seguir Editando la web?'))this.form.submit();
 window.close();
}
</script> 
</head>
<body>
<form>
<input type="Text" id="Dato" name="Dato" style="width:70px"><br>
<input type="button" value="RecuperaDato" onclick="recuperaDato();">
</form>
</body>
</html> 
..con la primera madre no me funciona este codigo .
pero con este si

Código HTML:
<html>
<body>
<form>
  <input type="Text" id="contenido_es">
  <input type="button" value="Abre PopUp" onclick="window.open('editor.php','miventana','width=308,height=70,menubar=no');">
</form>
</body>
</html> 
apesar de que he copiado el mismo codigo no me logra enviar la variable..desde el formulario en la ventana hija..prfavor necesito la ayuda ade alguien ..
  #2 (permalink)  
Antiguo 03/04/2008, 15:26
Avatar de ElJavista
Colaborador
 
Fecha de Ingreso: marzo-2007
Ubicación: Lima Perú
Mensajes: 2.231
Antigüedad: 17 años, 1 mes
Puntos: 67
Re: Problema Enviando Variable Desde Popup A Ventana Madre

Pues en ningún lugar estoy viendo que envías una variable y que la recoges, para hacerlo solo tienes que incluir un parámetro en la URL de la ventana hija, de este modo:

<input type="button" value="Abre PopUp" onclick="window.open('editor.php?var=$val','mivent ana','width=308,height=70,menubar=no');">

En la página hija debes hacer lo siguiente:

<?php
$val = $_GET["var"];
?>

Ya tienes el valor, ahora lo podrías colocar en un campo oculto si quieres utilizarla en alguna función.
  #3 (permalink)  
Antiguo 03/04/2008, 22:38
Avatar de Bellenger  
Fecha de Ingreso: noviembre-2004
Ubicación: En un lugar del Mundo...
Mensajes: 599
Antigüedad: 19 años, 5 meses
Puntos: 4
Re: Problema Enviando Variable Desde Popup A Ventana Madre

Revisa este link..{Comunicacion entre Ventanas con JavaScript...}
__________________
Un Caballero Jura Lealtad. Usa su espada para suprimir la Injusticia No Conoce el Odio y Tampoco el AMOR...
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:36.