Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OOO cant wait ALMOST THER!!!! 1

Status
Not open for further replies.

VspecGTR3

Technical User
Feb 3, 2003
62
US
How do i create a progress bar not based on time but based on how much longer to load the page.
 
here's one way:

first thing in your body will be a <div> to contain the bar.

then periodically throughout the html, add <script></script> tags to increment the bar.

Code:
<html>
<head>
<title>progress bar</title>
<style type=&quot;text/css&quot;>
#progressContainer {
	position:absolute;
	left:25%;
	top:25%;
	width:50%;
	border:2px outset threedface;
	text-align:left;
}
#progressBar {
	background-color:highlight;
	border:1px solid highlight;
	width:0%;
}
</style>

</head>

<body>
<div id=&quot;progressContainer&quot;>
	Please wait...loading...
	<div id=&quot;progressBar&quot;></div>
</div>
<br/>
stuff...
<script language=&quot;javascript&quot;>
	document.getElementById(&quot;progressBar&quot;).style.width = &quot;25%&quot;;
	for (x = 0; x< 1000000; x++) var foo = &quot;bar&quot;;   
</script>

<br/>
more stuff...
<script language=&quot;javascript&quot;>
	document.getElementById(&quot;progressBar&quot;).style.width = &quot;50%&quot;;
	for (x = 0; x< 1000000; x++) var foo = &quot;bar&quot;;   
</script>

<br/>
still more stuff...
<script language=&quot;javascript&quot;>
	document.getElementById(&quot;progressBar&quot;).style.width = &quot;75%&quot;;
	for (x = 0; x< 1000000; x++) var foo = &quot;bar&quot;;   
</script>

<br/>
even more stuff...
<script language=&quot;javascript&quot;>
	document.getElementById(&quot;progressBar&quot;).style.width = &quot;100%&quot;;
	for (x = 0; x< 1000000; x++) var foo = &quot;bar&quot;;   
</script>

<br/>
done.
<script language=&quot;javascript&quot;>
	document.getElementById(&quot;progressContainer&quot;).style.display = &quot;none&quot;;  
</script>

</body>
</html>
=========================================================
if (!succeed) try();
-jeff
 
thanks this code will work great with my file upload script to let users know how much more to display THANKS!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top