Parent.Hmtl
Die Codekopie lautet wie folgt:
<! DocType html public "-// w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<kopf>
<meta http-äquiv = "content-type" content = "text/html; charset = utf-8">
<title> übergeordnetes Fenster </title>
<script type = "text/javaScript">
window.onload = function () {
var btn = document.getElementById ("btn");
btn.onclick = function () {
var obj = {
Test: "Zhang San geht zum Kinderfenster", "
Win: Fenster
};
var returnValue = window.showmodaldialog ("child.html", obj, "dialogleft: 100px; dialogTop: 100px; Dialogwidth: 400px; DialogHeight: 300px; resizierbar: Ja");
if (returnValue! = null) {
document.getElementById ("Inhalt"). Innerhtml = returnValue;
}
};
}
</script>
</head>
<body>
<div id = "content" style = "margin: 50px; width: 100px; Höhe: 150px; Rand: 5px fest #0000ff;"> </div>
<Eingabe type = "button" id = "btn" value = "popup subwindow">
</body>
</html>
Child.html
Die Codekopie lautet wie folgt:
<! DocType html public "-// w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<kopf>
<meta http-äquiv = "content-type" content = "text/html; charset = utf-8">
<title> subfenster </title>
<script type = "text/javaScript">
window.onload = function () {
// den URL -Pass -Parameter erhalten
var args = window.dialogargumente;
var win = args.win; // Vorsitzender Fensterobjekt
var content = document.getElementById ("Inhalt");
content.Value = args.test;
var btn = document.getElementById ("btn");
btn.onclick = function () {
// Das modale Dialogfeld hat den Wert
window.returnValue = content.value;
Fenster.CLOSE ();
}
}
</script>
</head>
<body>
<Eingabe type = "text" id = "content"> <Eingabe type = "button" id = "btn" value = "value an übergeordnetes Fenster übergeben">
</body>
</html