parent.hmtl
La copie de code est la suivante:
<! Doctype html public "- // w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<adal>
<meta http-equiv = "contenu-type" contenu = "text / html; charset = utf-8">
<Title> Fenêtre parent </TITME>
<script type = "text / javascript">
window.onload = function () {
var btn = document.getElementById ("btn");
btn.onclick = function () {
var obj = {
Test: "Zhang San passe à la fenêtre de l'enfant",
gagner: fenêtre
};
var returnValue = window.showmodaldialog ("child.html", obj, "Dialogleft: 100px; dialogtop: 100px; dialogwidth: 400px; dialogheight: 300px; resibable: oui");
if (returnvalue! = null) {
document.getElementById ("Content"). InnerHtml = returnValue;
}
};
}
</cript>
</ head>
<body>
<div id = "contenu" style = "margin: 50px; largeur: 100px; hauteur: 150px; bordure: 5px solide # 0000FF;"> </div>
<input type = "bouton" id = "btn" value = "popup subwindow">
</docy>
</html>
child.html
La copie de code est la suivante:
<! Doctype html public "- // w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<adal>
<meta http-equiv = "contenu-type" contenu = "text / html; charset = utf-8">
<Title> Sous Fenêtre </TITME>
<script type = "text / javascript">
window.onload = function () {
// Obtenez le paramètre Pass URL
var args = window.dialogarguments;
var win = args.win; //
var content = document.getElementById ("Content");
contenu.value = args.test;
var btn = document.getElementById ("btn");
btn.onclick = function () {
// la boîte de dialogue modale aura la valeur
window.ReturnValue = content.Value;
window.close ();
}
}
</cript>
</ head>
<body>
<input type = "text" id = "contenu"> <input type = "bouton" id = "btn" value = "pass de valeur à la fenêtre parent">
</docy>
</ html