zoukankan      html  css  js  c++  java
  • asp.net 加页面Loading效果

            protected void Page_Load(object sender, EventArgs e)
            
    {
                
    if (!IsPostBack)
                
    {
                    Loading();
                }

            }


            
    public static void Loading()
            
    {
                HttpContext hc 
    = HttpContext.Current;
                hc.Response.Write(
    "<div id='loading'> ");
                hc.Response.Write(
    "<img src='Images/Loading/loading.gif'/> ");
                hc.Response.Write(
    "</div>");
                
    //hc.Response.Write("<script>mydiv.innerText = '';</script>");
                hc.Response.Write("<script type=text/javascript>");
                hc.Response.Write(
    "function document.onreadystatechange()");
                hc.Response.Write(
    @"{ try  
                                       {
                                        if (document.readyState == 'complete') 
                                        {
                                             delNode('loading');
                                            
                                        }
                                       }
                                     catch(e)
                                        {
                                            alert('页面加载失败');
                                        }
                                                            } 

                                function delNode(nodeId)
                                {   
                                    try
                                    {   
                                          var div =document.getElementById(nodeId); 
                                          if(div !==null)
                                          {
                                              div.parentNode.removeChild(div);   
                                              div=null;    
                                              CollectGarbage(); 
                                          } 
                                    }
                                    catch(e)
                                    {   
                                       alert('删除ID为'+nodeId+'的节点出现异常');
                                    }   
                                }

                                
    ");

                hc.Response.Write(
    "</script>");
                hc.Response.Flush();
            }
  • 相关阅读:
    ES6/5比较
    Javascript中的var和let
    git中remotes/origin/HEAD指向的分支丢失
    js实用篇之数组、字符串常用方法
    JS设计模式一:单例模式
    Linux C 面试题总结 .
    深入理解javascript原型和闭包(15)——闭包
    一些有意思的面试题(持续更新) .C语言编程技巧札记
    一个三流大学生的北京三年 .
    C 字节对齐.我的算法学习之路
  • 原文地址:https://www.cnblogs.com/s021368/p/1531488.html
Copyright © 2011-2022 走看看