当前位置: 代码迷 >> ASP >> 关于客户端是否选中checkbox的有关问题
  详细解决方案

关于客户端是否选中checkbox的有关问题

热度:134   发布时间:2012-03-19 22:03:04.0
关于客户端是否选中checkbox的问题
我在第一页
  function   del_cyc()
{    
    if(confirm( '确定删除此部门吗!? '))
    {document.xoYuStudioH.action= "DepartmentDel.asp ";
      document.xoYuStudioH.submit();
      return   true;
      }
      return   false;
  }
<input   type= "checkbox "   name= "BM_id "   value= " <%=rscyc( "BM_id ")%> "   />
<input   onClick= "javascript:del_cyc(); "   name= "xoYuStudioDo4 "   value= "删除部门 "   type= "button "   title= "删除选定记录 "   />
DepartmentDel.asp   这一页  
我这样做的
<%
bm_id=request( "bm_id ")
    tmp   =   split(bm_id, ", ")
      i=ubound(tmp)
      if   i <> 0   then  
      %>
        <script   language= "JavaScript ">
alert( "请选择一个部门进行修改! ");
history.go(-1);
</script>
<%else
。。。。。。。。。。。

end   if%>
请问   第二页的操作   如何放到第一页在客户端判断   是否选中一个
checkbox   或者   只能选择一个   谢谢

------解决方案--------------------
function del_cyc()
{
var sForm = document.xoYuStudioH;
var num = 0;
for(var i=0;i <=sForm.BM_id.length-1;i++)
{
(sForm.BM_id(i).checked)?num+=1: ' '
}
if(num== '0 ')
{
alert( '请选择您要删除的纪录! ');
return false;
}
if(confirm( '确定删除此部门吗!? '))
{
document.xoYuStudioH.action= "DepartmentDel.asp ";
document.xoYuStudioH.submit();
return true;
}
return false;
}

<input type= "checkbox " name= "BM_id " value= " <%=rscyc( "BM_id ")%> " />
<input onClick= "javascript:del_cyc(); " name= "xoYuStudioDo4 " value= "删除部门 " type= "button " title= "删除选定记录 " />
  相关解决方案