控件还没创建好 may be贴全代码

解决方案 »

  1.   

    是不是用户控件不行?
    ----
    Pub放在asp.net自定义控件里面?Pub如果是服务器控件,则原因是生成的id不再是Pub,如果是html控件并且无runat="server"则没有问题
      

  2.   

    <script type="text/javascript">
    function checkFiles() 
    {
    if(document.form1.checkFile.checked){
    document.getElementById("pub").style.display = "";
    }else{
    document.getElementById("pub").style.display = "none";
    }
    }
    </script><form action="" name="form1">
    <input type="checkbox" name="checkFile" onClick="checkFiles()">
    <div id="pub" style="display:none;font-size:30px;color:red">Hello world</div>
    </form>
      

  3.   

    你上面的代码没问题选中显示Hello world 不选中什么也不显示