前台:<input id="cboxShow" name="cboxShow" type="checkbox" />
后台:ClientScript.RegisterStartupScript(GetType(), "x", "document.getElementById('cboxShow').checked='checked';", true);
我这样写怎么不行啊。应该怎么写?求教。

解决方案 »

  1.   

    <input type="checkbox" id="chk" runat="server" />后台chk.Checked = true;
      

  2.   

    ClientScript.RegisterStartupScript(GetType(), "x", "document.getElementById('cboxShow').checked=true;", true);
      

  3.   

    <input id="cboxShow" name="cboxShow" type="checkbox" />
    <script>
    cboxShow.checked = true;
    </script>
      

  4.   

    方法一<input  加一个 runat="server" 
    把他变成服务器控件再做控制
    方法二 在页面body用onload调用js