• 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();
            }
  • 相关阅读:
    <Redis开发与运维> 阅读笔记
    请求行,请求头,请求体详解
    char 与 varchar 的区别
    python字符串的常用方法。
    快速排序的代码及原理
    C#之Dictionary源码
    C#中构造函数
    U3D——单例模式的用法
    U3D学习——设置VS2019作为开发工具
    U3D学习——脚本运行周期
  • 原文地址:https://www.cnblogs.com/s021368/p/1531488.html
Copyright © 2020-2023  润新知