checkBox复选框判断简便方式

checkBox复选框判断简便方式

 

< script type = " text/javascript " >
            function btn_change_click()
            
{
                var url 
= "<%=request.getContextPath()%>/rmp/reqchange/beforeChangeOrder.do";
                var  inputChecked 
= document.getElements("input[name='ckids']").filterByAttribute("checked","=",true);
                
if(inputChecked.length>1)
                
{
                    alert(
"每次只能操作一条记录");
                    
return;
                }

                
if(inputChecked.length<1)
                
{
                    alert(
"请选择一条记录");
                    
return;
                }

                window.location 
=url + "?orderId=" + inputChecked[0].value;
                
            }
            
    
        
</ script >


    
< input type = " button "   class = " button_1 "  id = " button4 "  value = "  项目变更  "  onclick = " btn_change_click() " >

< input type = " checkbox "  name = " ckids "  value = " 111 " />
< input type = " checkbox "  name = " ckids "  value = " 222 " />

你可能感兴趣的:(checkBox复选框判断简便方式)