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();
            }
  • 相关阅读:
    多叉树
    PowerDesigner设置集锦(2)
    Delphi应用程序在命令行下带参数执行返回命令行提示的问题
    不允许在 '*******' 上使用扩展属性,或对象不存在
    仓库管理系统开发完成
    动态创建Frame窗体(根据类名,除T以外的字母)
    Access中的常用TSQL
    批量删除同类文件(带通配符)
    判断Access数据库中的表或查询是否存在的SQL
    序列化FastReport,重要提示少走弯路
  • 原文地址:https://www.cnblogs.com/s021368/p/1531488.html
Copyright © 2011-2022 走看看