JS 控制Checkbox

function CheckChange(checkbox, DivGroup) {
             obj = document.getElementById(DivGroup);
             //obj.style.display = chk.Checked;

             o = document.getElementsByTagName("INPUT")
             for (i = 0; i < o.length; i++) {
                 if (o[i].type == "checkbox" && o[i].name == checkbox) {
                     //alert(o[i].value)
                     if (o[i].checked) {
                         obj.style.display = "";
                     }
                     else {
                         obj.style.display = "none";
                     }
                     break; 
                 }
             }
         }

 

以上是html 的checkbox 控制 客户端的DIV 隐藏和显示,DIV不可设置 runat=”server”

开始用getElementById找控件,没有成功

posted @ 2011-05-30 16:26  叮/当  阅读(806)  评论(0编辑  收藏  举报