parent.hmtl
A cópia do código é a seguinte:
<! Doctype html public "-// w3c // dtd html 4.01 transitório // pt" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<ditle> Janela dos pais </ititure>
<script type = "text/javascript">
window.onload = function () {
var btn = document.getElementById ("btn");
btn.OnClick = function () {
var obj = {
Teste: "Zhang San passa para a janela da criança",
Win: janela
};
var returnValue = window.showModaldialog ("Child.html", obj, "Dialogleft: 100px; Dialogtop: 100px; DialogWidth: 400px; DialogHeight: 300px; Redable: Sim");
if (returnValue! = null) {
document.getElementById ("Content"). Innerhtml = returnValue;
}
};
}
</script>
</head>
<Body>
<div id = "content" style = "margem: 50px; largura: 100px; altura: 150px; borda: 5px sólido #0000ff;"> </div>
<input type = "button" id = "btn" value = "pop -up subwindow">
</body>
</html>
criança.html
A cópia do código é a seguinte:
<! Doctype html public "-// w3c // dtd html 4.01 transitório // pt" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<title> sub Window </ititle>
<script type = "text/javascript">
window.onload = function () {
// Obtenha o parâmetro de passagem de URL
var args = window.dialogarguments;
var win = args.win; // objeto de janela presidência
var content = document.getElementById ("Content");
content.value = args.test;
var btn = document.getElementById ("btn");
btn.OnClick = function () {
// A caixa de diálogo modal terá o valor
window.returnValue = Content.value;
window.close ();
}
}
</script>
</head>
<Body>
<input type = "text" id = "content"> <input type = "button" id = "btn" value = "passa valor para a janela do pai">
</body>
</html