function DisableOption(vl)
    {
        var elems= document.getElementsByName("SelectA");
        if(typeof(elems)=="object")
        {
            for(i=0;i<elems.length;i++)
            {
                if(vl==elems[i].value)
                {
                    elems[i].disabled=true;
                }
            }
        }
     }调用这个方法传值:4

解决方案 »

  1.   


    <input  type =checkBox id = SelectA name = SelectA VALUE=1 > 
    <input  type =checkBox id = SelectA name = SelectA VALUE=2 > 
    <input  type =checkBox id = SelectA name = SelectA VALUE=4 > 
    <input  type =checkBox id = SelectA name = SelectA VALUE=6 > 
    <input  type =checkBox id = SelectA name = SelectA VALUE=9 > 
    <input  type =checkBox id = SelectA name = SelectA VALUE=10 > 
    <script language="JavaScript">
    <!--
    function Hid(){
    var ochk = document.getElementsByName("SelectA");
    for(var i = 0;i<ochk.length;i++)
    (ochk[i].value == 4) && (ochk[i].disabled = true) }
    //-->
    </script>
    <input type="button" value="禁用4" onclick="Hid()">
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
    <title></title> 
    <style type="text/css">
    </style>
    <script>
    function lock(val){
    var boxes = document.getElementsByTagName("input");
    for(var n=0;n<boxes.length;n++){
    if(boxes[n].type == 'checkbox'&&boxes[n].value == val) {
    boxes[n].disabled = 'disabled';
    }
    }
    }
    </script>
    </head>
    <body>
    <input type="checkbox" value="1" /><input type="checkbox" value="2" /><input type="checkbox" value="3" /><br />
    <input type="button" value="disable值为1的" onclick="lock(1)" /><input type="button" value="disable值为1的" onclick="lock(2)" /><input type="button" value="disable值为1的" onclick="lock(3)" />
    </body> 
    </html>
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
    <title></title> 
    <style type="text/css">
    </style>
    <script>
    function lock(val){
    var boxes = document.getElementsByName("selectA");
    for(var n=0;n<boxes.length;n++){
    if(boxes[n].value == val) {
    boxes[n].disabled = 'disabled';
    }
    }
    }
    </script>
    </head>
    <body>
    <input type="checkbox" name="selectA" value="1" /><input type="checkbox" name="selectA" value="2" /><input type="checkbox" name="selectA" value="3" /><br />
    <input type="button" value="disable值为1的" onclick="lock(1)" /><input type="button" value="disable值为1的" onclick="lock(2)" /><input type="button" value="disable值为1的" onclick="lock(3)" />
    </body> 
    </html>