建站代码网

热门标签

复选按钮变单选JS

<script type="text/javascript">

 
    
function checkBoxValidate(cm,cb) {
var ctxt;
//ctxt= document.getElementById("remark"+cm);
//ctxt=ctxt.value;
 
for (j = 0; j <= 3; j++) {
if (eval("document.myform.ckbox"+cm+"[" + j + "].checked") == true) {
eval("document.myform.ckbox"+cm+"[" + j + "].checked=false")

if (j == cb) {
eval("document.myform.ckbox"+cm+"[" + j + "].checked=true")
//window.open("update.asp?cid="+cm+"&vid="+j+"&remark="+ctxt,’xuan’,’’)    
}
}
}
}


function Savevalue(obj)
{
var id = null;//这个是要的id
if(obj){
   id=obj.id;
}
var Ctxt,ProId;
Ctxt= document.getElementById(id);
Ctxt=Ctxt.value;
 
id=id.replace("remark","");
window.open("update.asp?cid="+id+"&remark="+Ctxt,’xuan’,’’)    
}
</script>

<tr>
        <td colspan="8" align="center" bgcolor="#FFFFFF"><strong>学生部分</strong></td>
        </tr>
     
     <%
  m=1
Set Rs = Server.CreateObject("ADODB.Recordset")
sql="select * from subject where tou=1 and player=1 order by id asc"
Rs.open sql,conn,1,1
 
while not Rs.eof

vop=replace(rs("vop")," ","")
vop=replace(vop,"A.","")
vop=replace(vop,"B.","")
vop=replace(vop,"C.","")
vop=split(vop,"||")
%>
     <tr>
        <td width="6%" align="center" bgcolor="#FFFFFF"><%=m%></td>
        <td width="52%" align="center" bgcolor="#FFFFFF"><%=Rs("title")%></td>
        <%for n=0 to ubound(vop)  %>
  <td width="6%" align="center" bgcolor="#FFFFFF">
<input name="ckbox<%=rs("id")%>" type="checkbox" onClick="javascript:checkBoxValidate(<%=rs("id")%>,<%=n%>)" value="<%=n%>"></td>
        <td width="8%" align="center" bgcolor="#FFFFFF"><%=vop(n)%></td>
  <% next %>
        
     </tr>
    <%
 m=m+1
Rs.movenext
wend
rs.close
%>
        </table>
     

X