[英]How to control Loading panel using master page and without using AJAX
I have an asp.net project and I want to show the progress image (GIF) without using AJAX and using simple java-script DIV magic. 我有一个asp.net项目,我想显示进度图像(GIF), 而不使用AJAX和简单的Java脚本DIV魔术。
All I want to do is to put one div (which show animation clock while page loading in progress) in master page (asp.net master page so I need not to repeat the code on every content pages) and show it when page load is in progress. 我要做的就是在母版页(asp.net母版页)中放置一个div(在加载页面时显示动画时钟),因此我无需在每个内容页面上重复代码)并在加载页面时显示它进行中。
I hope your understand what I want to do. 希望您能理解我要做什么。
Thanks, 谢谢,
You can achieve like this 你可以这样实现
<body style="background-color:#FFFFFF;" onLoad="init()">
<div id="loading" style="position:absolute; width:200px; height:163px; text-align:center;top:310px; left:487px;">
<img src="images/loading.gif" border=0 style="margin:38px"/>
</div>
<script>
var ld=(document.all);
var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;
if (ns4)
ld=document.loading;
else if (ns6)
ld=document.getElementById("loading").style;
else if (ie4)
ld=document.all.loading.style;
function init()
{
if(ns4){ld.visibility="hidden";}
else if (ns6||ie4) ld.display="none";
}
</script>
make 2 sections in your document's body 在文档的正文中分成两部分
<div id="progress">
// Code for gif image
</div
<div id="content" style="display:none;">
// Whole page content
</div>
And after that include this javascript. 然后添加此javascript。 Not in header
不在标题中
<script>
document.getElementById("progress").style.display = 'none';
document.getElementById("content").style.display = 'block';
</script>
If you know jQuery you can do similarly on $(document).ready() event 如果您知道jQuery,则可以对$(document).ready()事件进行类似的操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.