【发布时间】:2014-10-30 20:46:49
【问题描述】:
当页面在 asp.net 应用程序中重定向时,我使用了加载屏幕图像。我使用 html 文件作为导航的中间体。
所以首页的点击事件是这样的,
Div1.onclick = function () {
location = "Redirect.htm?page=Default.aspx";
};
但在 Default.aspx 页面开始加载几秒钟后图像停止旋转。
这是我在 Redirect.html 中的代码,
<div style='position:absolute;z-index:9999;top:40%;left:40%;'>
<img id="imgAjax" alt="loading..." title="loading..." src="images/ajax-loading.gif" style="width: 250px; height: 250px" /><br /> <br />
</div>
<script type="text/javascript">
this.focus();
redirect = function() {
var querystring = window.location.search.substring(1); //first query string
var page = querystring.substring(querystring.indexOf('=') + 1, querystring.length);
function toPage() {
if (page !== undefined && page.length > 1) {
document.write('<!--[if !IE]>--><head><meta http-equiv="REFRESH" content="1;url=' + page + '" /><\/head><!--<![endif]-->');
document.write(' \n <!--[if IE]>');
document.write(' \n <script type="text/javascript">');
document.write(' \n var version = parseInt(navigator.appVersion);');
document.write(' \n if (version>=4 || window.location.replace) {');
document.write(' \n window.location.replace("' + page + '");');
document.write(' document.images["imgAjax"].src = "/images/ajax-loading.gif"');
document.write(' \n } else');
document.write(' \n window.location.href="' + page + '";');
document.write(' \n <\/script> <![endif]-->');
}
}
return {
begin: toPage
}
} ();
redirect.begin();
/* ]]> */
</script>
如何使图像旋转直到页面 Default.aspx 完全加载?
任何想法都会有所帮助并非常感谢。
谢谢。
【问题讨论】:
标签: javascript c# jquery html asp.net