父页面用window.open()打开子页面,子页面向父页面input域回传值(不刷新 参数的传递) |
test.htm <html> <body>
------------------------------------------------------------------------------------------ a.html </script> |
JAVA: 求一个画面间传值的JS例子~(急)
只知道可以弹出一个画面,然后 子画面显示父画面的值,然后把父画面关闭,代码如下:
A.html
<html>
<head>
<script language="javascript">
function go() {
window.open("B.html");
}
</script>
</head>
<body>
<input type="text" id="text1" /><br>
<input type="text" id="text2" /><br>
<input type="button" value="go" onclick="go()" />
</body>
</html>
B.html
<html>
<head>
<script language="javascript">
function onload() {
document.getElementById("text1").value = window.opener.document.getElementById("text1").value;
document.getElementById("text2").value = window.opener.document.getElementById("text2").value;
window.opener.close();
}
</script>
</head>
<body onload="onload()">
<input type="text" id="text1" /><br>
<input type="text" id="text2" /><br>
</body>
</html>