the progress bar that i have is working for a fixed time period (30 seconds). i want to be able to stop the progress bar when the page that i'm loading has finished loading. how can i tell if the page has completely loaded? i can use some help on that. the code for progress bar looks like this:
thanks for help.
Code:
<p>Displays progress bar in status bar and/or in a div in the page as required.</p>
<p><b><font color = "blue"></p>
<div id = "pbar"></div></b></font>
<script type = "text/javascript">
var percent = 10; // adjust starting value to suit
var timePeriod = 150; // adjust milliseconds to suit
function getBar() {
var retBar = '';
for (i = 0; i < percent; i++) {
retBar += "|";
}
return retBar;
}
function progressBar() {
if (percent < 100) {
percent = percent + 1;
document.getElementById("pbar").innerHTML = "        Loading : " + percent + "%" + " " + getBar();
window.status = "Loading : " + percent + "%" + " " + getBar();
setTimeout ("progressBar()", timePeriod);
}
else {
document.getElementById("pbar").innerHTML = "";
window.status = "Your message here";
document.body.style.display = "";
}
}
progressBar();
</script>