这里提供两种实现传值的方法。
第一种是直接通过获取父窗口id后传值,
例:window.opener.document.getElementById(id).value;
第二种是通过使用document.all,all[]是一个多功能的类似数组的对象,提供了对文档中所有HTML元素的访问
详细见http://www.w3school.com.cn/jsref/coll_doc_all.asp
代码实现(包含两种方法)
父窗口:
<input type="text" id="value1" name="value2" />
<input type="button" id="btn" value="开始" οnclick="window.open('Default2.aspx','','width=500,height=100')"/>
子窗口:
<input type="text" id="text"/>
<input type="button" value="传值" οnclick="window.opener.document.getElementById('value1').value = document.getElementById('text').value"/>
<input type="button" value="传值1" οnclick="window.opener.document.all.value2.value = document.getElementById('text').value"/>