Ver Mensaje Individual
  #7 (permalink)  
Antiguo 01/05/2008, 08:55
Avatar de nicolaspar
nicolaspar
 
Fecha de Ingreso: noviembre-2004
Ubicación: Villa Ballester Bs-As|Ar
Mensajes: 2.002
Antigüedad: 19 años, 5 meses
Puntos: 34
Re: Frames y variables

Desde del hijo llamas a una función javascript que esta en el padre y que tome dicho valor...simple, aunque nada tiene que ver con php ya que sería todo JavaScript; desde el hijo:

HIJO: (hijo.html)
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=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<script language="javascript" type="text/javascript">
function enviar(){
    var f = document.formulario;
    var valor = f.texto.value;
    window.parent.mostrarValorHijo( valor );
}
</script>
</head>

<body>

<form name="formulario" id="formulario">
<textarea name="texto" id="texto"></textarea>
<a href="javascript:enviar()">Enviar</a>
</form>
</body>
</html>
PADRE: (padre.html)
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=iso-8859-1" />
<title>test</title>
<script language="javascript" type="text/javascript">
function mostrarValorHijo( valor ){
    alert( "valor: "+valor )
}
</script>
</head>
<body>
<iframe src="hijo.html" width="400" height="500"></iframe>
</body>
</html>
Se puede simplificar, por ejemplo entrando directamente por DOM desde el padre al hijo (pero por ahí no lo comprendes), y hasta se podría hacer vía ajax...en fin, espero sirva. Saludos.
__________________
Mi punto de partida es Que Bueno Lo Nuevo