Le formulaire parent obtient iframe
window.iframeid
iframe obtient la fenêtre parent
fenêtre.
parent.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> Insérer le titre ici </TITME>
<script type = "text / javascript">
fonction btnfn () {
window.subwin.test ();
}
fonction get (name) {
return document.getElementById (nom);
}
</cript>
</ head>
<body>
<input id = "name" type = "text" value = "222">
<entrée type = "bouton" id = "btn" value = "cliquez" onclick = "btnfn ();"> <br/>
<br/> <br/>
<iframe src = "sub.html" id = "subwin"
name = "subwin" marginwidth = "0"
marginheight = "0" scrolling = "oui" frameborder = "0" valign = "middle"
redimense = "no" style = "affichage: block; border: 3px solide rouge;"> </ iframe>
</docy>
</html>
sub.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> Insérer le titre ici </TITME>
<script type = "text / javascript">
fonction test () {
alert (window.parent.get ("name"). valeur); // Résultat: 222
}
</cript>
</ head>
<body>
Je suis le contenu du formulaire
</docy>
</html>