<script type="text/javascript">
    function checkInfo()
    {
     var delBox=myForm.delBox;
     for(var i=0;i<delBox.size;i++)
     {
     if(delBox[i].checked)
     {
     return true;
     }
     }
     alert("请选择需要删除的会员!");
     return false;
    }
        
    </script>这个函数是表单验证的 如果全不选中就失败提示选择删除的会员,有选中的就提交表单
delBox[i]没有checked属性啊...

解决方案 »

  1.   


    function checkInfo() 

        var delBox = document.getElementsByName("delBox"); 
        for(var i=0; i<delBox.length; i++) 
        { 
            if(delBox[i].checked) 
            { 
                return true; 
            } 
        } 
        alert("请选择需要删除的会员!"); 
        return false; 

            
      

  2.   


    <script type="text/javascript"> 
    function checkInfo() { 
        var delBox=myForm.delBox; 
        for(var i=0;i <delBox.length;i++)
        if(delBox[i].checked) {alert("请选择需要删除的会员!");return false; }
        return true; 

    </script> 
      

  3.   

    改正<script type="text/javascript"> 
    function checkInfo() { 
        var delBox=myForm.delBox; 
        for(var i=0;i <delBox.length;i++)
            if(!delBox[i].checked) {alert("请选择需要删除的会员!");return false; }
        return true; 

    </script> 
      

  4.   

    改正 <body>
    <form name=myForm>
    <input type=checkbox name=delBox>
    <input type=checkbox name=delBox>
    <input type=checkbox name=delBox>
    <input type=button onclick=checkInfo() value=ok>
    </form><script type="text/javascript"> 
    function checkInfo() { 
        var delBox=myForm.delBox; 
        for(var i=0;i <delBox.length;i++)
        if(delBox[i].checked) return true
        alert("请选择需要删除的会员!")
        return false

    </script> 
    </body>
      

  5.   

    or:
    <body>
    <form name=myForm onsubmit=checkInfo()>
    <input type=checkbox name=delBox>
    <input type=checkbox name=delBox>
    <input type=checkbox name=delBox>
    <input type=submit  value=ok>
    </form><script type="text/javascript"> 
    function checkInfo() { 
        var delBox=myForm.delBox; 
        for(var i=0;i <delBox.length;i++)
        if(delBox[i].checked) return true
        alert("请选择需要删除的会员!")
        return false

    </script> 
      

  6.   

    <form id  = 'myForm' name = 'myForm'>
    <input type = 'checkbox' id = 'delBox' name = 'delBox' />
    <input type = 'checkbox' id = 'delBox' name = 'delBox' />
    <input type = 'checkbox' id = 'delBox' name = 'delBox' />
    <input type = 'checkbox' id = 'delBox' name = 'delBox' />
    <input type = 'checkbox' id = 'delBox' name = 'delBox' />
    </form><script type="text/javascript"> 
        function checkInfo() 
        { 
        //var delBox=myForm.delBox; 
    var delBox = document.getElementsByName('delBox');
    alert(delBox.length);
        for(var i=0;i <delBox.length;i++) 
        { 
        if(delBox[i].checked) 
        { 
        return true; 
        } 
        } 
        alert("请选择需要删除的会员!"); 
        return false; 
        } 
            
        </script> 
      

  7.   

    我记得是i<delBox.length吧,,, ?