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>
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号