用了下面一个方法,一点按钮整个页面就乱了,CSS完全不起作用!代码哪里错了?求高手帮忙改改!public static void Loading()
{
HttpContext hc = HttpContext.Current;
hc.Response.Write("<div id='loading'> ");
hc.Response.Write("<img src='loading.gif'/> ");
hc.Response.Write("</div>");
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();c# asp.net loading
要用ajax+json
为什么要在后台去写呢
你可以搜索:jquery ajax
refer: http://www.w3school.com.cn/jquery/ajax_ajax.asp
http://blog.csdn.net/smeyou/article/details/6218965
如果你必须在后台代码中绘制HTML及JS,可以使用以下方法:后台添加JS:Page.ClientScript中提供的方法。
后台绘制JS:
重写Page的Render方法。