测试页面:
<html>
<head>
<title>测试</title>
<script>
function selectWin(index)
{
if(index==1)
{
window.open("1.html");
}
else
{
window.open("2.html");
}
}
</script>
</head>
<form name="myform">
<table>
<tr>
<td>选择</td>
<TD>
<INPUT type="checkbox" name="chk" value="1" onclick="selectWin(this.value)">选择一
<INPUT type="checkbox" name="chk" value="2" onclick="selectWin(this.value)">选择二
</TD>
<tr>
<tr>
<td>
<input type="text" name="txt1">
<input type="text" name="txt2">
</td></tr>
</table>
</form>
</html>
1.html
<html>
<head>
<title>测试</title>
<script>
function returnVal(index)
{
window.opener.document.forms[0].txt1.value=index;
window.close();
}
</script>
</head>
<form name="myform">
<table>
<td>
<input type="text" name="txt1">
<input type="button" value="返回" onClick="returnVal(document.forms[0].txt1.value);">
</td></tr>
</table>
</form>
</html>
2.html:
<html>
<head>
<title>测试</title>
<script>
function returnVal(index)
{
window.opener.document.forms[0].txt2.value=index;
window.close();
}
</script>
</head>
<form name="myform">
<table>
<td>
<input type="text" name="txt1">
<input type="button" value="返回" onClick="returnVal(document.forms[0].txt1.value);">
</td></tr>
</table>
</form>
</html>
<html>
<head>
<title>测试</title>
<script>
function selectWin(index)
{
if(index==1)
{
window.open("1.html");
}
else
{
window.open("2.html");
}
}
</script>
</head>
<form name="myform">
<table>
<tr>
<td>选择</td>
<TD>
<INPUT type="checkbox" name="chk" value="1" onclick="selectWin(this.value)">选择一
<INPUT type="checkbox" name="chk" value="2" onclick="selectWin(this.value)">选择二
</TD>
<tr>
<tr>
<td>
<input type="text" name="txt1">
<input type="text" name="txt2">
</td></tr>
</table>
</form>
</html>
1.html
<html>
<head>
<title>测试</title>
<script>
function returnVal(index)
{
window.opener.document.forms[0].txt1.value=index;
window.close();
}
</script>
</head>
<form name="myform">
<table>
<td>
<input type="text" name="txt1">
<input type="button" value="返回" onClick="returnVal(document.forms[0].txt1.value);">
</td></tr>
</table>
</form>
</html>
2.html:
<html>
<head>
<title>测试</title>
<script>
function returnVal(index)
{
window.opener.document.forms[0].txt2.value=index;
window.close();
}
</script>
</head>
<form name="myform">
<table>
<td>
<input type="text" name="txt1">
<input type="button" value="返回" onClick="returnVal(document.forms[0].txt1.value);">
</td></tr>
</table>
</form>
</html>