parent.hmtl
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> ventana principal </title>
<script type = "text/javaScript">
window.onload = function () {
var btn = document.getElementById ("btn");
btn.onclick = functer () {
var obj = {
Prueba: "Zhang San pasa a la ventana del niño",
Ganar: ventana
};
var returnValue = window.showModalDialog ("child.html", obj, "dialogleft: 100px; dialogTop: 100px; dialogwidth: 400px; dialogHeight: 300px; reenizable: sí");
if (returnValue! = null) {
document.getElementById ("contenido"). innerHtml = returnValue;
}
};
}
</script>
</ablo>
<Body>
<div id = "content" style = "margen: 50px; ancho: 100px; altura: 150px; borde: 5px sólido #0000ff;"> </div>
<input type = "botón" id = "btn" value = "PopUp Subwindow">
</body>
</html>
niño.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> subventana </title>
<script type = "text/javaScript">
window.onload = function () {
// Obtener el parámetro de pase de URL
var args = window.dialogarguments;
var win = args.win; // Objeto de ventana Presidente
var content = document.getElementById ("contenido");
content.value = args.test;
var btn = document.getElementById ("btn");
btn.onclick = functer () {
// El cuadro de diálogo modal tendrá el valor
Window.ReturnValue = content.value;
window.close ();
}
}
</script>
</ablo>
<Body>
<input type = "text" id = "content"> <input type = "button" id = "btn" valor = "valor de aprobación a la ventana principal">
</body>
</html