zoukankan      html  css  js  c++  java
  • holding waiting screen until next page show

    需求:
          从A跳转到B页面,或者Post B页面时,如果B页面执行时间过久,客房端的屏幕会长时间处于空白.
    如果显示一个waiting gif,用户体验会好很多.
    分析:
          在跳转前,先清空body所有元素,然后动态加载一个waiting gif到body,注意Waiting gif重新加载,不然图片会静止

    代码段:
    <body>
     <a href="content.aspx" onclick="switchLoading();">TTTTTTTTTTTTTTTTTTTTTTTTT</a>
    <script>
     function ShowHoldScreenLayer(container) {
            document.body.innerHTML = "";
            var _holdScreenLayerObject = null;
            if (_holdScreenLayerObject == null) {
                _holdScreenLayerObject = document.createElement("<span>");
                _holdScreenLayerObject.style.display = "none";
                _holdScreenLayerObject.style.position = "absolute";
                _holdScreenLayerObject.style.left = 0;
                _holdScreenLayerObject.style.top = 0;
                _holdScreenLayerObject.style.zIndex = 999;
                _holdScreenLayerObject.style.width = document.body.clientWidth;
                var posLeft = (window.screen.width - 250) / 2;
                var posTop = (window.screen.height - 200) / 2;
                var oDiv1 = document.createElement("<div style='POSITION: absolute;LEFT:" + posLeft + "px;Top:" + posTop + "px;display:block; TEXT-ALIGN: center;border:0px; border-style:solid; border-color:#aaa;background-color:#fff;cursor:wait;color:#000; hasLayout:-1;250px;'></div>");
                //oDiv1.innerHTML = "<h3 style=\"margin:5px;padding:2px;\"><img src=\"/images/busy.gif\" /> Please wait...</h3>";
                oDiv1.innerHTML = "<img src=\"/images/wait.gif\" />";
                _holdScreenLayerObject.appendChild(oDiv1);
                if (typeof (container) == "undefined") {
                    container = document.body;
                }
                container.appendChild(_holdScreenLayerObject);
            }
            _holdScreenLayerObject.style.display = "block";
        }
    </script>
  • 相关阅读:
    在编码转错的情况下,如何恢复
    【娱乐】给你的电脑检查兼容性,并获取你的电脑上安装的软件
    发布一个纯PHP的中文关键字自动提取工具
    [转]程序员能力矩阵 Programmer Competency Matrix
    解决PHP数组内存耗用太多的问题
    哈希表之数学原理
    PHP高级编程之单线程实现并行抓取网页
    如何自动的检测字符串编码
    如何检测网络中断, 并自动重启网卡
    完全二叉树判断,简单而复杂
  • 原文地址:https://www.cnblogs.com/DataFlow/p/1551268.html
Copyright © 2011-2022 走看看