转载自:http://blog.csdn.net/smartsmile2012/article/details/7971763
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>loading效果</title>
- <script language="javascript" type="text/javascript" src="/Scripts/jquery-1.4.4.min.js"></script>
- <script type="text/javascript">
- function showLoad(tipInfo) {
- var eTip = document.createElement('div');
- eTip.setAttribute('id', 'tipDiv');
- eTip.style.position = 'absolute';
- eTip.style.display = 'none';
- eTip.style.border = 'solid 0px #D1D1D1';
- eTip.style.backgroundColor = '#4B981D';
- eTip.style.padding = '5px 15px';
- eTip.style.top = '10px';
- eTip.style.right = '10px';
- eTip.style.width = '120px';
- eTip.innerHTML = '<img src=\'/Images/loader.gif\' style=\'float:left;\' /> <span style=\'color:#ffffff; font-size:12px\'>' + tipInfo + '</span>';
- try {
- document.body.appendChild(eTip);
- } catch (e) { }
- $("#tipDiv").css("float", "right");
- $("#tipDiv").css("z-index", "99");
- $('#tipDiv').fadeIn();
- }
- function closeLoad() {
- $('#tipDiv').fadeOut();
- }
- </script>
- </head>
- <body>
- <input type="button" value="查看效果" onclick="showLoad('正在运行中...');" />
- <input type="button" value="关闭效果" onclick="closeLoad();" />
- </body>
- </html>
- <asp:Button ID="Button1" runat="server" Text="查询施工价格" OnClientClick="showLoad('正在查询中...');" OnClick="Button1_Click" />
- protected void Button1_Click(object sender, EventArgs e)
- {
- //处理完成后
- ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "close", "closeLoad();", true);
- }