请问除了动态输出checked让多选框为选中状态外,还有其它方法吗??因为……

duxingxue 2003-09-29 04:20:54
因为文档中有好些多选框,我从库中输出要修改的值,有的话则输出checked
可是当我用“重新选择”按钮重新选择的时候,则checked状态还在?
请问有除response.write(" checked")之外的办法吗?


注:onClick="putGoodValue(<%=i%>)" 和onClick="setcheckNull()"为我写的其它功能。

<input type="checkbox" name="aa" onClick="putGoodValue(<%=i%>)"
<%if RS1("org_id")<>"" then
response.write(" checked")
end if
%>
>
<input type='reset' value='重新选择' onClick="setcheckNull()">
...全文
78 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
awaysrain 2003-09-30
  • 打赏
  • 举报
回复
<input type='reset' value='重新选择' onClick="setInputNull()">
--->
<input type='button' value='重新选择' onClick="setInputNull()">

你去掉选择了然后又reset了当然又选上了
duxingxue 2003-09-30
  • 打赏
  • 举报
回复
我的代码是这样的。为什么不行??

按“重新选择”怎样把aa,bb的钩都去掉?


<html>
<head>
<title></title>
<meta http-e="Content-Type" content="text/htmlquiv; charset=gb2312">
</head>
<style>
td{font-size:9pt}
body{font-size:10.5pt}
</style>
<script>

function setInputNull()
{

var cbs = document.getElementsByName("aa");

//var cbs = document.getElementsByTagName("input");

for(var i=0;i<cbs.length;i++)
{
cbs[i].checked=false;
}

var cbs = document.getElementsByName("bb");

//var cbs = document.getElementsByTagName("input");

for(var i=0;i<cbs.length;i++)
{
cbs[i].checked=false;
}
}

</script>



<body bgcolor="#FFFFFF" >


<form name="FormSelect" method="post">
<table border=0 cellpadding=1 cellspacing=1 align="center">
<tr bgcolor="#CCCCCC" align="center">
<td align="center" height="25" width="26"><b>序号</b></td>
<td height="25" width="153"><b>名称</b></td>
<td height="25" width="55"><b>较好</b></td>
<td height="25" width="41"><b>较差</b></td>
</tr>
<tbody>
<tr bgcolor="eeeeee">
<td align="center" bgcolor="eeeeee" width="26"><font color=red>107</font></td>
<td width="153" bgcolor="eeeeee">公司1</td>
<td width="55" align="center" bgcolor="eeeeee">
<input type="checkbox" name="aa" value="84506" onClick="putGoodValue(106)" checked>
好</td>
<td width="41" align="center">
<input type="checkbox" name="bb" value="84506" onClick="putBadValue(106)" >
差</td>
</tr>
<tr bgcolor="eeeeee">
<td align="center" bgcolor="eeeeee" width="26"><font color=red>108</font></td>
<td width="153" bgcolor="eeeeee">公司2</td>
<td width="55" align="center" bgcolor="eeeeee">
<input type="checkbox" name="aa" value="84501" onClick="putGoodValue(107)" checked>
好</td>
<td width="41" align="center">
<input type="checkbox" name="bb" value="84501" onClick="putBadValue(107)" >
差</td>
</tr>
<tr bgcolor="eeeeee">
<td align="center" bgcolor="eeeeee" width="26"><font color=red>109</font></td>
<td width="153" bgcolor="eeeeee">公司3</td>
<td width="55" align="center" bgcolor="eeeeee">
<input type="checkbox" name="aa" value="7707" onClick="putGoodValue(108)" checked>
好</td>
<td width="41" align="center">
<input type="checkbox" name="bb" value="7707" onClick="putBadValue(108)" >
差</td>
</tr>
<tr bgcolor="eeeeee">
<td align="center" bgcolor="eeeeee" width="26"><font color=red>110</font></td>
<td width="153" bgcolor="eeeeee">公司4</td>
<td width="55" align="center" bgcolor="eeeeee">
<input type="checkbox" name="aa" value="758" onClick="putGoodValue(109)" >
好</td>
<td width="41" align="center">
<input type="checkbox" name="bb" value="758" onClick="putBadValue(109)" >
差</td>
</tr>
<tr bgcolor="eeeeee">
<td align="center" bgcolor="eeeeee" width="26"><font color=red>111</font></td>
<td width="153" bgcolor="eeeeee">公司5</td>
<td width="55" align="center" bgcolor="eeeeee">
<input type="checkbox" name="aa" value="84524" onClick="putGoodValue(110)" >
好</td>
<td width="41" align="center">
<input type="checkbox" name="bb" value="84524" onClick="putBadValue(110)" checked>
差</td>
</tr>
<tr bgcolor="eeeeee">
<td align="center" bgcolor="eeeeee" width="26"><font color=red>112</font></td>
<td width="153" bgcolor="eeeeee">公司6</td>
<td width="55" align="center" bgcolor="eeeeee">
<input type="checkbox" name="aa" value="84300" onClick="putGoodValue(111)" >
好</td>
<td width="41" align="center">
<input type="checkbox" name="bb" value="84300" onClick="putBadValue(111)" checked>
差</td>
</tr>
<tr bgcolor="eeeeee">
<td align="center" bgcolor="eeeeee" width="26"><font color=red>113</font></td>
<td width="153" bgcolor="eeeeee">公司7</td>
<td width="55" align="center" bgcolor="eeeeee">
<input type="checkbox" name="aa" value="84314" onClick="putGoodValue(112)" >
好</td>
<td width="41" align="center">
<input type="checkbox" name="bb" value="84314" onClick="putBadValue(112)" checked>
差</td>
</tr>
<tr >
<td width="26" ></td>
<td width="153"></td>
<td width="55">
<input type="hidden" name="aa" value="" >
</td>
<td width="41">
<input type="hidden" name="bb" value="" >
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td valign='bottom' align='center' colspan="4" >
<input type='reset' value='重新选择' onClick="setInputNull()">
<input type='button' value='关闭窗口' onClick="window.close()">
</td>
</tr>
</tbody>
</table>
</form>

</body>
</html>
awaysrain 2003-09-30
  • 打赏
  • 举报
回复
<script language="JavaScript">
function myReset()
{
//form1.reset();
var cbs = document.getElementsByTagName("input");
for(var i=0;i<cbs.length;i++)
{
if(cbs[i].type=="checkbox")
cbs[i].checked=false;
}
}
</script>
<form name="form1" method="post" action="">
<p>
<input type="checkbox" name="checkbox" value="checkbox">
<br>
<input name="checkbox2" type="checkbox" value="checkbox" checked>
<br>
<input type="checkbox" name="checkbox3" value="checkbox">
<br>
<input name="checkbox4" type="checkbox" value="checkbox" checked>
<br>
<input type="checkbox" name="checkbox5" value="checkbox">
</p>
<p>
<input type="button" name="Reset" value="重新选择" onClick="myReset()">
</p>
</form>

duxingxue 2003-09-30
  • 打赏
  • 举报
回复
高手都去哪了?
pas 2003-09-29
  • 打赏
  • 举报
回复
不在,把数据写到JS代吗中

87,904

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧