我的页面由于处理的东西比较多 所以加载的比较慢 点击连接后半天不会有反映  所以我想 在页面没有加载完成前 显示一个<div>页面加载中....</div> 加载完成后自动将这个层隐藏  再点击连接时显示这个层 完成后隐藏层 显示加载完成后界面 但是 我不知道该怎么做 请各位帮帮忙

解决方案 »

  1.   

    把没用到viewstate的控件的enableviewstate设置成false,那个加载中的需要用到ajax。
      

  2.   

    你的问题跟我的是一样的问题,我初步想用jquery的ajax来实现,不过具体怎么写就不知道了,等做过的大牛给点帮助了
      

  3.   

    很抱歉 关键是我不知道 怎样用Ajax加载 能说说吗
      

  4.   

    用ajax实现,updatepanle中给出两个div,第一个是<div>页面加载中....</div> 第二个是<div>登录输入框和按钮</div>,在页面后台设置程序等待时间,显示第一个div,时间过了显示登录后的信息
      

  5.   

    http://zkh43javaeye.javaeye.com/blog/567665
      

  6.   

    你可以这样:
    1.在你的登陆页面加一个div,用于显示loading提示。
    <div id="loadwait" class="white_content">页面加载中....</div>
    2.再加一个div,用于屏蔽加载时对页面的操作
    <div id="loadback" class="black_overlay">CSS(效果你可以自己调,这里给个例子):
    .black_overlay
    {
    display:none;
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    background-color: #dcdcdc;
    z-index:1001; 
    -moz-opacity: 0.8;
    opacity:.80;
    filter: alpha(opacity=80);

           
    .white_content 
    {
    display:none;
    position: absolute;
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
    padding: 10px;
    border: 10px solid orange;
    background-color: White;
    z-index:1002;
    overflow: auto;
    } 做好这些之后,在你的后台load事件最前面加上:
     Page.RegisterStartupScript("aaa", "<script>ShowDiv('loadwait')</script>");
     Page.RegisterStartupScript("bbb", "<script>ShowDiv('loadback')</script>");在load事件最后面加上:
     Page.RegisterStartupScript("ccc", "<script>HideDiv('loadwait')</script>");
     Page.RegisterStartupScript("ddd", "<script>HideDiv('loadback')</script>");JS:
    //显示DIV
    function ShowDiv(id)
    {
       var div=document.getElementById(id);
       div.style.display='block';
    }//隐藏DIV
    function HideDiv(id)
    {
       var div=document.getElementById(id);
       div.style.display='none';
    }
      

  7.   

    参考 --------------把下面代码复制txt 然后修改后缀为html
    <script language="JavaScript">//configure refresh interval (in seconds)
    var countDownInterval=60;
    //configure width of displayed text, in px (applicable only in NS4)
    var c_reloadwidth=200</script>
    <ilayer id="c_reload" width= && #123;c_reloadwidth}; ><layer id="c_reload2" width= && #123;c_reloadwidth}; left=0 top=0></layer></ilayer><script>var countDownTime=countDownInterval+1;
    function countDown(){
    countDownTime--;
    if (countDownTime <=0){
    countDownTime=countDownInterval;
    clearTimeout(counter)
    window.location.reload()
    return
    }
    if (document.all) //if IE 4+
    document.all.countDownText.innerText = countDownTime+" ";
    else if (document.getElementById) //else if NS6+
    document.getElementById("countDownText").innerHTML=countDownTime+" "
    else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
    document.c_reload.document.c_reload2.document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
    document.c_reload.document.c_reload2.document.close()
    }
    counter=setTimeout("countDown()", 1000);
    }function startit(){
    if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
    document.write('离下一次<a href="javascript:window.location.reload()">刷新</a>还有 <b id="countDownText">'+countDownTime+' </b>秒')
    countDown()
    }if (document.all||document.getElementById)
    startit()
    else
    window.onload=startit</script>
      

  8.   

    我的已经解决的,给楼主试试看吧,代码很简单,页面引用下jquery1.4.2或其他版本即可
    方法:
    function gotoLoading() {
       $("#divMessage").click();//这里是弹出loading笼罩层,我是用的jquery的fancybox,楼主自定义吧
       $.get("WebForm1.aspx", function(data) {
           window.location = "WebForm1.aspx";  //这里是加载成功执行的方法   });
    }
    在你的超链接上调用即可
      

  9.   

    我感觉12楼的思路不错,就是在有两个<div>加载中</div>、<div>你的页面</div>
    低一个div设置成显示的,第二个设置成隐藏的。然后在</html>刚刚加载完之前用javas吧第一个设置成隐藏,第二个设置成显示就成了。但是没必要那么复杂直接在aspx页面插入css和JavaScript代码就成了。
      

  10.   


    <html>
    <body>
    <div id="loading" style="display: block;">加载中</div>
    <div id="content" style="display: none;">
    large text.........................................
    </div>
    <script language="javascript">
    var loading = document.getElementById("loading");
    var content = document.getElementById("content");
    loading.style.display = "none";
    content.style.display = "block";
    </script>
    </body>
    </html>
      

  11.   

    首先 jqery是可以很好的实现页面ajax的加载 但是组件太恶心了 而且限制很多 这里我用了12楼的思路 在按钮或超链接上面加上调用代码就完全可以实行 集体得带吗是
    function startDelay(str)
         { 
             var t;
             t=setTimeout("startTask()",300);
             document.getElementById("<%=hide.ClientID %>").value=str;
              
             return true;
            
             
         } 
        
        function startTask()
        {
         window.location= document.getElementById("<%=hide.ClientID %>").value; 
           
            var lo=document.getElementById("logon"); 
            var lg=document.getElementById("backloading");
                 
                        lg.style.display="block";   
                        lo.style.display="block";
             return true;                
        }
        function onTaskCompleted()
        {             var lo=document.getElementById("logon");       
                        lo.style.display="none"; 
                var lg=document.getElementById("backloading");
                        lg.style.display="none";  
        }
        </script>
    <div id="backloading" style="display:none;width:100%;height:2000px;position:absolute;z-index:1000;border:0px;background-color:#cccccc;margin:0px;padding:0px;filter:alpha(opacity=50);"align="center"></div>      
            <!--弹出层显示内容-->
            <div id="logon"  align="center" style=" text-align:center;display:none;background-color:#ffffff;position:absolute;border:3px solid #ffffff; left: 400px; top: 270px; z-index:1001"> 
              
                    <div>
                      <div> <h5> <asp:Image ID="Image2" runat="server" ImageUrl="~/images/loading.gif" style="z-index:1002" /></h5> </div> 
                      <div>数据正在加载,请稍候.....</div>
                      </div>
             </div>
    然后在超链接上或按钮上调用startDelay(str)就行了 非常好用