会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
天下無雙
阿龍 --质量是流程决定的。
博客园
首页
博问
闪存
新随笔
订阅
管理
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();
}
posted on
2009-07-26 18:55
阿龍
阅读(
4307
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部