注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

伯纳乌の夢

可以挽回么?我们按“ Ctrl+Z”撤销掉吧。对不起啦~~

 
 
 

日志

 
 
 
 

點擊按鈕彈出Loading  

2013-12-16 20:27:53|  分类: Web |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

點擊按鈕彈出Loading - mgracy - 伯纳乌の夢
 
Javascript文件:

function showloading() {
          var loaddiv;
          if (loaddiv = document.getElementById("loaddiv")) {
              loaddiv.style.display = "block";
          } else {
              loaddiv = document.createElement("DIV");
              loaddiv.id = "loaddiv";
              loaddiv.style.position = "absolute";
              loaddiv.style.zIndex = 1000;
              loaddiv.style.display = "";
              loaddiv.style.left = 0;
              loaddiv.style.top = 0;
              loaddiv.style.border = "1px solid gray"
              loaddiv.style.background = "#ffffff"
              loaddiv.style.padding = "5";
          }

          var scrollTop = 0;
          if (top.document.documentElement && top.document.documentElement.scrollTop) {
              scrollTop = top.document.documentElement.scrollTop;
          } else if (document.body) {
              scrollTop = top.document.body.scrollTop;
          }

          var scrollWid = document.body.scrollWidth / 2-150;

          loaddiv.style.left =scrollWid + "px";
          loaddiv.style.top = (scrollTop + 200) + "px";
          loaddiv.innerHTML = "";
          loaddiv.innerHTML = "<h><font size='8' color='#287CBA' >Loading...</font></h>";
          //document.body.style.cursor = "wait";


          var sWidth, sHeight;
          sWidth = document.body.scrollWidth; //??器工作?域??面?度 或使用 screen.width//屏幕的?度  
          sHeight = document.body.scrollHeight; //屏幕高度(垂直分辨率)  


          //背景?(大小与窗口有效?域相同,即??出??框?,背景?示?放射?透明灰色)  
          var bgObj = document.createElement("div"); //?建一?div?象(背景?) //???建元素,?里?建的是 div  
          //定?div?性,即相?于(相?于,但确不是,必???象?性?行定?  
          //<div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:10000;"></div>  
          bgObj.setAttribute('id', 'bgDiv');
          bgObj.style.position = "absolute";
          bgObj.style.top = "10";
          bgObj.style.background = "#ffffff";
          bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
          bgObj.style.opacity = "0.6";
          bgObj.style.left = "0";
          bgObj.style.width = sWidth + "px";
          bgObj.style.height = sHeight + "px";
          bgObj.style.zIndex = "10000";
          document.body.appendChild(bgObj); //在body?添加?div?象  

          document.body.appendChild(loaddiv);
      }

      function Sconfirm(a) {
          if (confirm(a)) {
              showloading();
              return true;
          }
          else {
              return false;
          }
      }



asp.net後台頁面調用
Button1.Attributes.Add("onclick", "javascript:return showloading()");

前台代碼

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="HRMS.HRMS.FORM.WebForm1" %>

<!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 runat="server">
    <title></title>
    <script language="javascript" src="http://mgracy.blog.163.com/blog/JavaScript/WebCalendar.js" type="text/javascript"></script>
    <script language="javascript" src="http://mgracy.blog.163.com/blog/JavaScript/loadingWaitTip.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
    </div>
    </form>
</body>
</html>

  评论这张
 
阅读(213)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017