主頁面:in.html
<代碼>
<html>
<body>
<%--主頁面一個隱藏域 iframe接到這個值 傳個另一個iframe --%>
<input type="hidden" name="xh" id="xh" value="2">
<iframe name="mainframe" marginwidth="0" marginheight="0" frameborder="0" src="in1.html" width="100%" scrolling="no" border="1" onload="this.height=450"></iframe>
<iframe name="mainframe2" marginwidth="0" marginheight="0" frameborder="0" src="in2.html" width="100%" scrolling="auto" border="1" onload="this.height=450"></iframe>
</body>
</html>
<代碼>
iframe1頁面:in1.html
<代碼>
<html>
<body>iframe1
<button onclick="javascript:fuzhi();">賦值<button>
</body>
<script type="text/javascript">
function fuzhi(){
//取得父頁面hidden對象
var xh= parent.document.getElementById('xh');
//將值傳給另一個iframe中
parent.frames['mainframe2'].document.getElementById("xh").value = xh.value;
}
</script>
</html>
<代碼>
iframe2頁面:in2.html
<代碼>
<html>
<body>iframe2
<input name="xh" id="xh" type="text" size="20" readonly="readonly"/>
</body>
<script type="text/javascript">
</script>
</html>
<代碼>
本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內容,請
點擊舉報。