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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

progress bar for webpage 2

Status
Not open for further replies.

shopwise

Technical User
Sep 22, 2008
52
US
Clicking a link on my webpage causes a window to popup which displays an iframe of another webpage of my site.

How do I get an animated preloader gif (already on my server) to display on this iframe window until the contents load?

I can't seem to find the right script for this.
 
Be easier with javascript - try forum216

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
I've done that with just an animated .GIF in a pop-up window, which then closes after the page loads.

Since the ASP is running at the server, and depending on your response.buffer value, may or may not load the entire page upon completion of the script, there's no "Easy" way to do a "Percentage of page loaded" or something like that in ASP that I've found.



Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
I have a reporting application that displays "Please Wait" while a report is being built and then when the report data is ready the message disappears and is replaced with the the report.

This is done with the following:


Response.Write("<html>" & vbCR)
Response.Write(" <head>" & vbCR)
Response.Write(" <title>" & ReportTitle & "</title>" & vbCR)
Response.Write(" <script language=""Javascript"">" & vbCR)
Response.Write("<!-- " & vbCR)
Response.Write("if (document.all) { " & vbCR)
Response.Write(" document.write('<span id=w>');" & vbCR)
Response.Write(" document.write('Please wait...');" & vbCR)
Response.Write(" document.write('</span>');" & vbCR)
Response.Write("}" & vbCR)
Response.Write("//-->" & vbCR)
Response.Write(" </script>" & vbCR)
Response.Write(" </head>" & vbCR)
Response.Write(" <body>" & vbCR)

Response.Flush()

'''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''' all the code to build the report ''''''''''

Response.Write(" <script>" & vbCR)
Response.Write(" <!--" & vbCR)
Response.Write(" if (document.all) {" & vbCR)
Response.Write(" document.all(""w"").style.display = 'none';" & vbCR)
Response.Write(" }" & vbCR)
Response.Write(" //-->" & vbCR)
Response.Write(" </script>" & vbCR)
Response.Write(" </body>" & vbCR)
Response.Write("</html>" & vbCR)


You could use the above but replace the "Please wait..." message with your animated gif.

ps - I only have to worry about IE
 
I've done that with just an animated .GIF in a pop-up window, which then closes after the page loads.
to which tag do I apply the onload function to? I tried the body tag but it doesn't work
 
you don't need to put onload anywhere

the second script tag is right at the bottom of the page (just before the </html> tag) so this script executes without calling onload on the body tag

What browser are you using - maybe it is because you are not using IE and document.all("w") is not working??
 
from all the progress bars that i have seen, this one seems to be the most straight forward and less code. works well with all the browsers.
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 = "&nbsp &nbsp &nbsp &nbsp 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>
i can not take credit for this code since it's not mine. but works well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top