zoukankan      html  css  js  c++  java
  • 显示网页加载进度条 程序员

    function initialize() {
    addcloud(); //为页面添加遮罩
    document.onreadystatechange = subSomething; //监听加载状态改变
    }
    function addcloud() {
    var bodyWidth = document.documentElement.clientWidth;
    var bodyHeight = Math.max(document.documentElement.clientHeight, document.body.scrollHeight);
    var bgObj = document.createElement("div" );
    bgObj.setAttribute( 'id', 'bgDiv' );
    bgObj.style.position = "absolute";
    bgObj.style.top = "0";
    bgObj.style.background = "#000000";
    bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75" ;
    bgObj.style.opacity = "0.5";
    bgObj.style.left = "0";
    bgObj.style.width = bodyWidth + "px";
    bgObj.style.height = bodyHeight + "px";
    bgObj.style.zIndex = "10001"; //设置它的zindex属性,让这个div在z轴最大,用户点击页面任何东西都不会有反应|
    document.body.appendChild(bgObj); //添加遮罩
    var loadingObj = document.createElement("div");
    loadingObj.setAttribute( 'id', 'loadingDiv' );
    loadingObj.style.position = "absolute";
    loadingObj.style.top = bodyHeight / 2 - 32 + "px";
    loadingObj.style.left = bodyWidth / 2 + "px";
    loadingObj.style.background = "url(/public/images/loading.gif)" ;
    loadingObj.style.width = "32px";
    loadingObj.style.height = "32px";
    loadingObj.style.zIndex = "10000";
    document.body.appendChild(loadingObj); //添加loading动画-
    }
    function removecloud() {
    $( "#loadingDiv").remove();
    $( "#bgDiv").remove();
    }
    function subSomething() {
    if (document.readyState == "complete" ) //当页面加载完毕移除页面遮罩,移除loading动画-
    {
    removecloud();
    }
    }

  • 相关阅读:
    http://www.bugku.com:Bugku——SQL注入1(http://103.238.227.13:10087/)
    [笔记]一道C语言面试题:大整数乘法
    [笔记] Access Control Lists (ACL) 学习笔记汇总
    [笔记]如何将传统的回调函数转换为C#5.0支持的await格式
    6.链接与导航
    9章 下拉菜单
    11章圆角框 本章很重要 经常用到
    原来链接与导航
    7竖直排列的导航菜单
    8.水平导航菜单
  • 原文地址:https://www.cnblogs.com/sallon/p/2803474.html
Copyright © 2011-2022 走看看