Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/01/2011, 11:05
marco64yes
 
Fecha de Ingreso: septiembre-2010
Mensajes: 350
Antigüedad: 13 años, 7 meses
Puntos: 9
Exclamación Problema con funcion, no pasa los datos

Hola que tal,,,
apenas encontre este codigo, el cual de una pagina padre recibe un dato de la pagina hijo...
los 2 codigos son estos:

PADRE:

Código:
<!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ítulo</title>
<script>
function openW()
{
 	W=window.open('hijo.php','popup','width=600,height=400');
	W.objetivo=document.getElementById('objetivo');
}

</script>
</head>

<body>


<input type='button' value='open' onclick='openW();'/>
<div id='objetivo'></div>
</body>

</html>
hijo:

Código:
<!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ítulo</title>
<script>
function actualizar()
{
  window.objetivo.innerHTML="Esto se escribe en el padre";
}
</script>
</head>

<body>


popup sample
<input type='button' value='actualizar' onclick='actualizar();'/>

</body>
</html>
Todo funciona ahi, pero si se dan cuenta todos los datos los manda hacia un div de la pagina del padre, pero yo lo necesito pasar a un textbox...
pero no se porque no lo realiza,, mo codigo del padre es:

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Word processor example</title>
<script>
function openW()
{
 	W=window.open('/gym_control/tinymce/examples/usuarios.php','popup','width=600,height=400','scrollbars=yes','toolbar=yes');
	W.objetivo=document.popup2.nsocio.value;
	
}

</script>
esta dentro de un form llamado popup2 ... y el textbox se llama nsocio.

la pagina del hijo :

Código:
    <script>
function actualizar(tipo)
{
	
	  window.objetivo.innerHTML=tipo;
}
</script>
Bueno que esta mal ?? ahi

Muchas gracias!!!