父页面:
    调用子页面的值:iframeName.window.document.getElementById("子页面元素ID").value
html:
<body>
    <input id="button" type="button" value="调用child.html中的函数say()" onclick="callChild()"/>
    <iframe name="myFrame" src="child.html"></iframe>
</body>

js:
<script type="text/javascript">
function say(){
    alert("parent.html");
}
function callChild(){
    myFrame.window.say();
    myFrame.window.document.getElementById("button2").value="调用结束";
}
</script>

子页面:
    调用父页面的值:parent.window.document.getElementById("父页面的元素ID").value
html:
<body>
    <input id="button" type="button" value="调用parent.html中的say()函数" onclick="callParent()"/>
</body>
js:
<script type="text/javascript">
function say(){
    alert("child.html");
}
function callParent(){
    parent.say();
    parent.window.document.getElementById("button1").value="调用结束";
}
</script>


10-18 05:26