欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

做一个多项选择界面,选择一项弹出一个新页面,选择完这一项之后,返回之前的html页面_html/css_WEB-ITnose

程序员文章站 2022-05-21 22:46:09
...
html

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

回复讨论(解决方案)

我现在已经做出了选择功能了,但是选择完一个再选另一个,之前已经选择好了的就找不到了

大侠们还没上班吗?

没人帮忙吗?这个很难吗?

测试页面:

 <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>