[size=large][color=blue]child.jsp[/color][/size]
[color=blue][size=large]parent.jsp[/size][/color]
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
<script type="text/javascript">
function parentValue(){
//var temp = document.getElementById('child').value;
this.opener.document.getElementById('dsfdsfdsf').value = "控制父窗口";//控制父窗口
//document.getElementById('test2').value = this.opener.name;//获取父窗口变量(我是父窗口)
}
</script>
</head>
<body onload="parentValue()">
<input type="text" value="23" id="sdfsdf">
</body>
</html>
[color=blue][size=large]parent.jsp[/size][/color]
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
<script type="text/javascript">
function popChild(){
alert("测试中");
var obj = window;
obj.name = '我是父窗口';
myWindow = window.open('child.jsp','Child','width=200,height=100');
///alert(myWindow);
myWindow.document.getElementById('sdfsdf').value = '我来自父窗口';
myWindow.focus();
}
</script>
</head>
<body>
<% %>
<form>
<input type="button" name="sheng" id="dsfdsfdsf" value="sheng" onclick="popChild()">
</form>
</body>
</html>