弹出层中中的iframe如何传值给主页面?
获得主页面需要这样的DOM节点和方法parent.
获得子页面的需要这样document.getElementById('iframeid').
main.html
[code="java"]
var newWindow; function makeNewWindow(){ newWindow = window.open("son.html","",Height=300,width=300); } function closeNewWindow(){ if(newWindow){ newWindow.close(); newWindow = null; } }
main.html
[/code]
son.html
[code="java"]
son.html
[/code]
iframe.html
var newWindow; function makeOpenerValue(){ top.window.opener.document.getElementById("myname").value="test"; }
iframe.html