我們只要在aspx頁(yè)面上加一個(gè)DIV一個(gè)button就可以來(lái)實(shí)現(xiàn)就可以達(dá)到目的, DIV設(shè)置如下:
<div id="divOver" runat="server" style="Z-INDEX: 12000; LEFT: 0px; WIDTH: 160; CURSOR: wait; POSITION: absolute; TOP: 0px; HEIGHT: 100">
<table style="width:17%; height:10%;"> <tr> <td> <table width="169" style="WIDTH: 160px; HEIGHT: 62px"> <tr align="center" valign="middle"> <td>交易正在處理中<br />Please waiting</td> </tr> </table> </td> </tr> </table> </div> 然后在后臺(tái)代碼中加上下面代碼:
protected void Page_Load(object sender, EventArgs e)
{ //注冊(cè)button1的onclick事件 this.Button1.Attributes.Add("onclick", "javascript:document.getElementById('divOver').style.visibility='visible';"); //運(yùn)行先把這個(gè)DIV隱藏起來(lái) divOver.Style.Add("visibility", "hidden"); } //button單擊后會(huì)發(fā)生一次頁(yè)面postback,預(yù)呈現(xiàn)里面添加把div隱藏 protected override void OnPreRenderComplete(EventArgs e) { divOver.Style.Add("visibility", "hidden"); } protected void Button1_Click(object sender, EventArgs e) { //預(yù)設(shè)button業(yè)務(wù)處理為5S Thread.Sleep(5000); }
|
|
來(lái)自: 悟靜 > 《網(wǎng)站設(shè)計(jì)》