我曾经写过一个asp.net的用户控件,包含以下功能: 1.等待直至所有页面元素加载完毕 2.等待直至所有iframe(包括嵌套)加载完毕 3.良好用户界面,有半透明等效果没有时间整理,需要的话给我发邮件吧 chagel AT gmail.com
直接在onload中触发js显示个DIV 就可以了吧,显示好了之后隐藏掉
做一個loading過渡 程序代码: <script language="Javascript"> //eat the error, paste this code before any javascript start to load, you need this error handler. window.onerror = doNothing function doNothing() {return true} </script> <script language="Javascript"> //display the loading box, paste this code after </head> document.writeln('<span id=loadingmsg style="border:1px ridge; Z-INDEX: 3; LEFT: 12; WIDTH: 131; POSITION: absolute; TOP: 18; HEIGHT: 50; BACKGROUND-COLOR: #FFFFFF"><CENTER><BR><font color="#808080"><FONT face=Arial size=3>Loading .....</FONT><BR></font></CENTER></span>') </script> <script language="Javascript"> // close the loading box, paste this at end of the document. if (document.all) document.all.loadingmsg.style.visibility='hidden'; if (document.layers) document.loadingmsg.visibility='hidden' if (document.getElementById) document.getElementById('loadingmsg').style.visibility='hidden' </script>
<script language="javascript>
function okClick()
{
Form1.btnAdd.disabled = true;
document.all["runing"].style.display = "";
Form1.btnOk.click();
}
</script><span id="runing" style="DISPLAY: none; Z-INDEX: 100; LEFT: 116px; VERTICAL-ALIGN: middle; WIDTH: 200px; COLOR: #990000; POSITION: absolute; TOP: 45px; HEIGHT: 30px; BACKGROUND-COLOR: white; TEXT-ALIGN: center"><IMG src="../images/runing.gif"></span>
<script>document.all["runing"].style.left=(document.body.clientWidth-200)/2</script>
<table class="table_fontstyle" height="22" cellSpacing="0" cellPadding="0" width="100%" bgColor="#a7cdf9" border="0">
<tr>
<td>
<asp:label id="lblAlert" runat="server" ForeColor="red"></asp:label></td>
<td align="right" width="135"><BUTTON class="btn_normal " id="btnAdd" onmouseover="this.style.color='red'" style="CURSOR: hand" onclick="okClick();" onmouseout="this.style.color='blue'" type="button" runat="server">增加</BUTTON><asp:button id="btnOk" style="DISPLAY: none" runat="server" Text="增 加"></asp:button> </td>
1.等待直至所有页面元素加载完毕
2.等待直至所有iframe(包括嵌套)加载完毕
3.良好用户界面,有半透明等效果没有时间整理,需要的话给我发邮件吧
chagel AT gmail.com
程序代码: <script language="Javascript"> //eat the error, paste this code before any javascript start to load, you need this error handler. window.onerror = doNothing function doNothing() {return true} </script>
<script language="Javascript"> //display the loading box, paste this code after </head> document.writeln('<span id=loadingmsg style="border:1px ridge; Z-INDEX: 3; LEFT: 12; WIDTH: 131; POSITION: absolute; TOP: 18; HEIGHT: 50; BACKGROUND-COLOR: #FFFFFF"><CENTER><BR><font color="#808080"><FONT face=Arial size=3>Loading .....</FONT><BR></font></CENTER></span>') </script>
<script language="Javascript"> // close the loading box, paste this at end of the document. if (document.all) document.all.loadingmsg.style.visibility='hidden'; if (document.layers) document.loadingmsg.visibility='hidden' if (document.getElementById) document.getElementById('loadingmsg').style.visibility='hidden' </script>
虽然那个div层隐藏起来了,但是我的网页最上面还是空出一行,怎么取消那行啊
Response.Write("window.setInterval('ShowWait()',1000);}");
Thread.Sleep(10000);要彻底解决问题,请注意:1、为了“提高”速度,你得将interval缩短,即根据你的目标网页的速度把1000变小;其次,那个睡眠时间10000也要视情况适当缩短;
2、由于这段代码是在目标网页之前传递到浏览器,因此可能会影响javascript控制其他div的操作,比如zoom。如果你的目标网页有这样的代码,你可以将这段代码单独做成一个网页,在body里面用onload将你的目标网页引入。
3、你嫌“正在装载网页”难看,你可以改成任何其他提示,包括引入图片。
===============
Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);Thread.Sleep(10000);
dontNetBusyBox