نموذج الوالدين يحصل على iframe
Window.IFrameId
iframe يحصل على النافذة الأصل
نافذة
Parent.html
نسخة الكود كما يلي:
<! doctype html public "-// w3c // dtd html 4.01 Transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "content-type" content = "text/html ؛ charset = utf-8">
<title> إدراج العنوان هنا </title>
<script type = "text/javaScript">
وظيفة btnfn () {
window.subwin.test () ؛
}
وظيفة الحصول على (الاسم) {
return document.getElementById (name) ؛
}
</script>
</head>
<body>
<input id = "name" type = "text" value = "222">
<type type = "button" id = "btn" value = "click" onClick = "btnfn () ؛"> <br/>
<br/> <br/>
<iframe src = "sub.html" id = "subwin"
name = "subwin" marginWidth = "0"
marginheight = "0" scrolling = "yes" frameborder = "0" valign = "middle"
تغيير حجم = "no" style = "display: block ؛ الحدود: 3px صلب أحمر ؛"> </iframe>
</body>
</html>
sub.html
نسخة الكود كما يلي:
<! doctype html public "-// w3c // dtd html 4.01 Transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "content-type" content = "text/html ؛ charset = utf-8">
<title> إدراج العنوان هنا </title>
<script type = "text/javaScript">
اختبار الوظيفة () {
التنبيه (window.parent.get ("الاسم"). القيمة) ؛ // النتيجة: 222
}
</script>
</head>
<body>
أنا محتوى النموذج
</body>
</html>