页面提交等待效果 2010.07.2

来源:互联网 发布:数据挖掘原理与技术 编辑:程序博客网 时间:2024/06/16 12:46

页面

  <div id="runing" runat="server" style="z-index:1200; left:0px; width:100%; cursor:wait; position:absolute;top:0px; height:100%">
    <table width:"100%" height:"100%">
    <tr align="center" valign="middle">
    <td>
    <table width="200" height="120" bgcolor="gray" style="filter:alpha(opacity=70); color:White">
    <tr align="center" valign="middle">
    <td>
    <div id="Clocktimes">
        <asp:Button ID="btnOk" runat="server" onclick="btnOk_Click" Text="开始" />
        </div><br />
    正在提交<br />
    请稍等.......
    </td>
    </tr>
   
    </table>
    </td>
    </tr>
    </table>
    </div>

 

后台:

 
    protected void Page_Load(object sender, EventArgs e)
    {
        this.btnOk.Attributes.Add("onclick","javascript:document.getElementById('runing').style.Visibility='visible'; window.setInterval('tick()',1000);");
    }

在页面中增加JavaScript脚本

       <script type="text/javascript">
    var times=0;
    function tick()
    {
     times++;
     var min=Math.floor(times/60);
     var scend=times-min*60;
     document.getElementById("Clocktimes").innerHTML=min+'分'+scend+'秒';
    }
    </script>

原创粉丝点击