从一个帖子上发现的,很有用的~~
帖子地址:http://community.csdn.net/Expert/TopicView3.asp?id=5713872
完全JS实现就可以了,给你看看htm页面代码。
a.htm页面:
<input id="text1" type="text" />
<input type="button" value="open" οnclick="window.open('b.htm', 'b', 'height=450, width=550, top=120, left=262, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')"/>
b.htm页面
<script>
function getText(){
v = document.getElementById("textMe").value;
objP = window.opener.document.getElementById("text1");
objP.value = v;
window.opener = null;
window.close();
}
</script>
输入值<input id="textMe" type="text" />
<input type="button" value="把这里输入的值赋值给父窗口中的textbox" οnclick="getText();"/>
注:有网友提出用window.opener.document.all("父窗口的标签ID").value="你想要向父窗口传递的变量值";
我记得这种方法好用是好用,不过在火狐浏览器下就会有问题,而getElementById是标准语法,不会出岔子
帖子地址:http://community.csdn.net/Expert/TopicView3.asp?id=5713872
回复人:BearRui(AK-47) ( ![]() | 2007-08-17 10:22:30 | 得分:0 |
完全JS实现就可以了,给你看看htm页面代码。
a.htm页面:
<input id="text1" type="text" />
<input type="button" value="open" οnclick="window.open('b.htm', 'b', 'height=450, width=550, top=120, left=262, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')"/>
b.htm页面
<script>
function getText(){
v = document.getElementById("textMe").value;
objP = window.opener.document.getElementById("text1");
objP.value = v;
window.opener = null;
window.close();
}
</script>
输入值<input id="textMe" type="text" />
<input type="button" value="把这里输入的值赋值给父窗口中的textbox" οnclick="getText();"/>
注:有网友提出用window.opener.document.all("父窗口的标签ID").value="你想要向父窗口传递的变量值";
我记得这种方法好用是好用,不过在火狐浏览器下就会有问题,而getElementById是标准语法,不会出岔子