一、子页面是父页面通过window.open弹出的情况子页面要向父页面传值,只要在document前面加window.opener即可。
如:
1.父页面代码:
无标题文档title>head>
function tanchu()
{
window.open("Untitled-5.html");
}
script>
οnclick="tanchu()" />
label>
label>
form>
2.子页面代码:
无标题文档title>head>
function aaa()
{
window.opener.document.getElementByIdx('textfield').value='123123123';
}
script>
οnclick="aaa()" />
label>
form>
二、子页面是iframe框架中的页面情况
子页面要向父页面传值,只要在document前面加parent即可。
1.父页面代码:
无标题文档title>head>
label>
iframe>
form>
2.子页面代码
无标题文档title>head>
function aa()
{
var a=parent.document.getElementByIdx('textfield').value;
alert(a);
}
script>
onClick="aa()" />
label>
form>