<input type="hidden" id="s"/>
子窗口
window.parent.docuent.getElementById("s").value=s
父窗口获得传的值
var str = document.getElementById("s").value
alert(str)
我在IE7下运行页面,可以把子窗口中的值传到父窗口中也可以这样改
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<script type="text/javascript">
function openWindow() {
window.open("childen.html")
}
</script>
</HEAD>
<BODY>
<input type="button" value="打开新窗口" onclick="openWindow()">
<hr>
这是父窗口<br>
<input id="content" type="text" name="content" >
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<script type="text/javascript">
function execute() {
var value = document.getElementsByName("content")[0].value
window.opener.document.getElementById("content").value=value
window.close()
}
</script>
</HEAD>
<BODY>
<input type="text" name="content" value="这是子窗口">
<input type="button" value="确定" onclick="execute()">
</BODY>
</HTML>