zoukankan      html  css  js  c++  java
  • 用 document.readyState == "complete" 判断页面是否加载完成。

            function MyLoading(falg) {
                var loading = "<div id='dlading' style='position:absolute;left:0;100%;height:100%;top:0;background:#FFFFFF;opacity:0.8;filter:alpha(opacity=90);'>";
                loading += "<div style='border:2px solid #B7CDFC;position:absolute;cursor:wait;left:50%;top:50%;200px;height:32px;line-height:28px;text-indent:36px;font-size:14px;background:#fff url(Content/css/images/loading.gif) no-repeat left center;'>";
                loading += "正在加载,请等待......</div></div>";
                if (falg) {
                    $("body", document).append(loading);
    
    
                } else {
                    if ($("#dlading") != undefined) {
                        $("#dlading").remove();
                    }
                }
            }
    
                        $(document).ready(function () {
                MyLoading(true);
                if (document.readyState == "complete") {
                    MyLoading(false);
                }
                if (document.readyState == "complete") {
                    MyLoading(false);
                }
                else {
                    document.onreadystatechange = function () {
                        if (document.readyState == "complete") {
                            MyLoading(false);
                        }
                    }
                }
    })

    如果这篇文章对您有帮助,您可以打赏我

    技术交流QQ群:15129679

  • 相关阅读:
    python并发之concurrent.futures
    全局解释器锁--GIL
    ASP 注释
    ASPxGridView 下拉框不让输入
    leftjoin及多个leftjoin执行顺序
    视图view没有主键,但可以添加唯一索引
    ASPxGridView KeyFieldName
    联合主键
    AspxGridView使用教程
    ASP Session 对象
  • 原文地址:https://www.cnblogs.com/yeminglong/p/2445260.html
Copyright © 2011-2022 走看看