页面加载进度条
2009-09-18 19:28
169 查看
public void Loading()
{
HttpContext hc = HttpContext.Current;
//创建一个页面居中的div
hc.Response.Write("<div id='loading'style='position: absolute; height: 100px; text-align: center;z-index: 9999; left: 50%; top: 50%; margin-top: -50px; margin-left: -175px;'> ");
hc.Response.Write("<br />页面正在加载中,请稍候<br /><br /> ");
hc.Response.Write("<table border='0' cellpadding='0' cellspacing='0' style='background-image: url(images/Progress/plan-bg.gif);text-align: center; width: 300px;'> ");
hc.Response.Write("<tr><td style='height: 20px; text-align: center'><marquee direction='right' scrollamount='30' width='290px'> <img height='10' src='images/Progress/plan-wait.gif' width='270' />");
hc.Response.Write("</marquee></td></tr></table></div>");
//hc.Response.Write("<script>mydiv.innerText = '';</script>");
hc.Response.Write("<script type=text/javascript>");
//最重要是这句了,重写文档的onreadystatechange事件,判断文档是否加载完毕
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();
}
{
HttpContext hc = HttpContext.Current;
//创建一个页面居中的div
hc.Response.Write("<div id='loading'style='position: absolute; height: 100px; text-align: center;z-index: 9999; left: 50%; top: 50%; margin-top: -50px; margin-left: -175px;'> ");
hc.Response.Write("<br />页面正在加载中,请稍候<br /><br /> ");
hc.Response.Write("<table border='0' cellpadding='0' cellspacing='0' style='background-image: url(images/Progress/plan-bg.gif);text-align: center; width: 300px;'> ");
hc.Response.Write("<tr><td style='height: 20px; text-align: center'><marquee direction='right' scrollamount='30' width='290px'> <img height='10' src='images/Progress/plan-wait.gif' width='270' />");
hc.Response.Write("</marquee></td></tr></table></div>");
//hc.Response.Write("<script>mydiv.innerText = '';</script>");
hc.Response.Write("<script type=text/javascript>");
//最重要是这句了,重写文档的onreadystatechange事件,判断文档是否加载完毕
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();
}
相关文章推荐
- 页面加载时,显示页面加载的进度
- 页面加载进度条、图片查看主键增大
- pace.js页面加载进度条插件
- [原型设计]Axure制作页面加载进度条效果
- jsp页面进度条加载
- 经典页面加载显示进度条8例
- [转]页面加载时,显示页面加载的进度
- js页面加载进度条
- 进度条加载完成后跳转到扫描二维码页面
- 页面加载进度条
- ajax页面加载进度条插件
- 页面加载进度条
- ajax页面加载进度条插件
- 页面加载进度条pace.js
- 在WebView中加载HTML页面时显示进度对话框的方法
- JavaScript页面加载进度条
- jquery实现页面加载进度条
- 页面加载进度条
- 基于jQuery实现模拟页面加载进度条
- 经典页面加载显示进度条 8例