就是这个多选框。<input type=checkbox name="yes2" checked>

解决方案 »

  1.   

    给你写了一个全的:
    <html>
    <head>
    <script>
    function checkIt()
    {
        var coll = document.getElementsByName("yes2"); 
        var c = 0; //记录被选中的checkbox的个数 
        
        for(var i = 0; i < coll.length; i++)
            if(coll[i].checked == true)
        c++;
        
        if(c > 3)
    alert("多于3个!")
        else
    alert("ok");
    }
    </script>
    </head>
    <body>
    <form name='form1'>
    <input type=checkbox name="yes2">111
    <input type=checkbox name="yes2">222
    <input type=checkbox name="yes2">333
    <input type=checkbox name="yes2">444
    <input type=button name=button value=test onclick=checkIt()>
    </form>
    </body>
    </html>