<script language=javascript type="text/javascript">
<!--
function disableNew(bt)
{
    bt.Enabled = false;
}
//-->
</script>
<asp:Button ID="bt_new" runat="server" OnClick="bt_new_Click"                         Text="New" Width="49px" />protected void Page_Load(object sender, EventArgs e)
{
 bt_new.Attributes.Add("onclick", "disableNew(this);");
}不起作用,请问有何良策?

解决方案 »

  1.   

    bt_new.Attributes.Add("onclick", "disableNew(this.form."+bt_new.clientID+");");
      

  2.   

    还要加一句,要不然会回发:
    bt_new.Attributes.Add("onclick", "disableNew(this.form."+bt_new.clientID+");return false;");
      

  3.   

    document.all("控件ID").style.display = "none"
      

  4.   

    楼主必须搞清楚客户端和服务端的关系!<script language=javascript type="text/javascript">
    <!--
    function dis(theId)
    {
        document.getElementById(theId).disabled = true;
        
    }
    //-->
    </script><asp:Button ID="bt_new" runat="server" Text="Button" />protected void Page_Load(object sender, EventArgs e)
    {
        this.bt_new.Attributes.Add("onclick", "dis('" + this.bt_new.ClientID + "');");
    }
      

  5.   

    不是有 Enabled="False",为什么还要用客户端的事件来搞呢?
      

  6.   

    bt_new.Attributes.Add("onclick", "this.disabled=true;return false;");
      

  7.   

    <script language=javascript type="text/javascript">
    <!--
    function disableNew(bt)
    {
        bt.disabled = (bt.disabled) ? false : true;
    }
    //-->
    </script>