El formulario de los padres obtiene iframe
Window.Frameid
iframe obtiene la ventana principal
ventana.
parent.html
La copia del código es la siguiente:
<! DocType html public "-// w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<Evista>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<title> Insertar título aquí </title>
<script type = "text/javaScript">
función btnfn () {
Window.subwin.test ();
}
función get (nombre) {
return document.getElementById (nombre);
}
</script>
</ablo>
<Body>
<input id = "name" type = "text" value = "222">
<input type = "button" id = "btn" value = "hacer clic" onclick = "btnfn ();"> <br/>
<br/> <br/>
<iframe src = "sub.html" id = "subwin"
nombre = "Subwin" MarginWidth = "0"
marginheight = "0" desplazamiento = "sí" frameBorder = "0" valign = "Middle"
resize = "no" style = "Display: block; border: 3px sólido rojo;"> </iframe>
</body>
</html>
sub.html
La copia del código es la siguiente:
<! DocType html public "-// w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<Evista>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<title> Insertar título aquí </title>
<script type = "text/javaScript">
función test () {
alert (window.parent.get ("nombre"). valor); // resultado: 222
}
</script>
</ablo>
<Body>
Soy el contenido de la forma
</body>
</html>