日期:2014-05-16  浏览次数:20584 次

做一个多项选择界面,选择一项弹出一个新页面,选择完这一项之后,返回之前的html页面
做一个多项选择界面,选择一项弹出一个新页面,选择完这一项之后,返回之前的主html页面。
比如说主页面A,有两个选择项,1和2,点击弹出对应的页面1和页面2,在这两个页面选择对应的东西,选择完页面1之后把数据返回到A主页面两个text里,继续选择页面2,选择完页面2后,数据返回到A主页面另一个text里
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>