我有两个 JS 函数:一个显示进度条的 load() 函数和一个在页面加载后停止执行加载的 kill() 函数。现在,当加载另一个页面时,不会显示进度条,因为知道在每个页面上都会调用 load 函数。关于问题可能出在哪里以及是否有解决方法的任何提示。
这是我的代码:
<script type="text/javascript">
var count=0;
function load(i) {
j = parseInt(i);
document.getElementById("progressBar").style.display = "block";
count=count+1;
if (document.all) {
document.all.btn1.value=count+'%';
document.all.progressbar.pic1.width=2*count;
}
else {
document.getElementById("pic1").width=2*count;
document.getElementById("bar").width=count+'%';
}
if (count<100) {
setTimeout('load(j)',j);
}
if(count==100) {
document.getElementById("progressBar").style.display = "none";
count=0;
}
}
function kill(){
if (document.applets[0].isActive()) {
document.getElementById("progressBar").style.visibility = "hidden";
}
}
</script>
先感谢您 !