如题,我有一个HMTL的BUTTON控件,以下是其HTML代码!<button type="button" onclick="print()" class="Noprint" style="WIDTH: 50px; HEIGHT: 25px">
打印</button>但是我要在执行完相应语句后才把它显示出来,要怎么写代码?先隐藏,再显示!在线等!最好有完整的例子,直接贴代码上来,请不要贴网址,谢谢!

解决方案 »

  1.   

    因为HTML的BUTTON没有Visible属性,所以不知如何控制!
      

  2.   

    dvbbs注册用户的“高级”选象
      

  3.   

    javascript:
    this.style.display = 'nono';//hide button
    this.style.display = '';//show the button
      

  4.   

    用代码CS文件里,要怎么控制?比如:、我执行完if()后,要显示这个BUTTON,怎么写??在点打开新的页面后这个BUTTON在pageLoad中要写入语句隐藏,要怎么写?
      

  5.   

    1) 为方便操作,把你的html button做为服务器控件,设现在为
    <button id="btn" runat="server" type="button" onclick="print()" class="Noprint" style="WIDTH: 50px; HEIGHT: 25px">
    打印</button>2)if (abcdefg....)
    {
    //show it
    btn.Attributes["Style"] = "WIDTH: 50px; HEIGHT: 25px";}page_load(...)
    {
    //hide it
    btn.Attributes["Style"] = "WIDTH: 50px; HEIGHT: 25px;display:none;";}
      

  6.   

    楼上的,程序会出错c:\inetpub\wwwroot\ly93\ly174_21.aspx.cs(74): 找不到类型或命名空间名称“btn”(是否缺少 using 指令或程序集引用?)
      

  7.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head><body><form method="POST" action="--WEBBOT-SELF--">
      
      <p><input type="button" value="按钮" name="B3" style="display:none" ></p>
    </form></body></html>
      

  8.   

    aspx 页中:
    <input type="button" value="按钮" ID="btn">双击页面,自动会在 .cs 中加上
    protected System.Web.UI.HtmlControls.HtmlInputButton btn;
    .cs 中:Page_Load() 事件:if(!IsPostBack)
    {
       btn.Visible = false;
    }然后在某个事件触发后写:
       btn.Visible = true;
      

  9.   

    楼上的,程序会出错c:\inetpub\wwwroot\ly93\ly174_21.aspx.cs(74): 找不到类型或命名空间名称“btn”(是否缺少 using 指令或程序集引用?)----------------------------------------吧button的ID设成btn
      

  10.   

    晕啊`~~~~~在你的那个Button上点右键,选 "做为服务器控件",再输入ID为btn不就完了吗??
      

  11.   

    "鼎鼎"同志说的很对嘛。这个方法我早就会用了,主要分为两步:
       1、将这个Html按钮,首先“作为服务器端控件”这项选中(操作方法:对准按钮点右键,然后选择),再对准按钮点右键,选择“属性”--将“ID”设为btn
       2、采用"鼎鼎"同志的方法,在cs文件里面写一下就行了。
      

  12.   

    aspx:
    <button type="button" onclick="print()" class="Noprint" style="WIDTH: 50px; HEIGHT: 25px"
    runat=server id="btn" name="btn">
    打印</button>aspx.cs:
    if( !IsPostBack )
    {
       btn.Visible = false;
    }
    ……
    当条件满足时:
    btn.Visibel = true;