如题,我有一个HMTL的BUTTON控件,以下是其HTML代码!<button type="button" onclick="print()" class="Noprint" style="WIDTH: 50px; HEIGHT: 25px">
打印</button>但是我要在执行完相应语句后才把它显示出来,要怎么写代码?先隐藏,再显示!在线等!最好有完整的例子,直接贴代码上来,请不要贴网址,谢谢!
打印</button>但是我要在执行完相应语句后才把它显示出来,要怎么写代码?先隐藏,再显示!在线等!最好有完整的例子,直接贴代码上来,请不要贴网址,谢谢!
this.style.display = 'nono';//hide button
this.style.display = '';//show the 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;";}
<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>
<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;
1、将这个Html按钮,首先“作为服务器端控件”这项选中(操作方法:对准按钮点右键,然后选择),再对准按钮点右键,选择“属性”--将“ID”设为btn
2、采用"鼎鼎"同志的方法,在cs文件里面写一下就行了。
<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;