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

Close alert message automatically 1

Status
Not open for further replies.

xsw1971

Programmer
Jun 21, 2001
153
US
I am using ColdFusion to display a screen that could take several minutes to build. The page does not begin to load until everything it needs has been pulled into memory and is ready to display.

Long story short, I would like to put an onclick event in the calling page that displays a simple pop-up message: "The following page may take a few minutes to load." By putting it in the calling page, it will be displayed immediately to the user. Problem is I don't want the user to have to click on the OK (in fact I don't even want an OK button, just a pop-up message). I would like it to go away on its own either when the called page is ready to be displayed or after x seconds.

I'm open to ideas if there is a better way to do this...

Thank you!
Jennie
 
For anyone that may come to this after i did (since I found this message via Google.com) I have a 170 KB .pdf file (not sure why it's so large) that I wanted those on dial-up to see, and not just forget it, so I created a load processor for a webpage, Actually, just marching ...'s so they would have something to stare at for 20-30 sceonds while the pdf loads. When the loading page is done, I have it close the &quot;The PDF document is loading...&quot; window. To do this, was very, very very simple, although I didn't realize how simple until 4 chapters later in a Wrox Javascript book, and 3 hours surfing the net. The link to open the .pdf file (or whatever file you need open, will call a fuction call it go_to_next_page() or whatever. The <script></script> should look something like the following. I'm taking the liberty to assume you have a basic knowledge of javascripting and can read into some of this code without it all being explained.

<script>
//The go_to_next_page() is called from your link with an
//onclick=&quot;&quot; in the anchor tag

function go_to_next_page()
{
window.open(&quot;message.html&quot;, &quot;name&quot;);
window.location=&quot;page_that_takes_forever_to_load.html&quot;;

//You can add whatever features to the message window you
//want

}

</script>

Now, you are done with that page, because that javascript is gone, since you have window.location to a new webpage, the one you want to open up. For the simple one line of code that eluded me for longer than I wish to say in a forum that my peers can see %-( . Now onto the <script></script> that will go with your message.html window.

This is the one line of code that will close your message.html window.

window.opener.onload=self.close();

!!!!! That's it. I used a setTimeOut timer to animate the .... at the end of my The PDF document is loading.... and I included that line just before the setTimeOut made the loop happen again. I don't really think it matters where you put that line, it will be executed when the opener window {NOTE: window.opener refers to the window which created the window you are working in.) Since the window which now displays my .pdf document is the opener, the onload bolean goes from False to True when the PDF document (or any large web page for that matter) is loaded, and then calls the self.close(); to get rid of itself nice and neatly. I hope this helps someone save some time.

Jarod Morris
jallenmorris@homtail.com

&quot;When in Roman, speak like a Roman.&quot; translation: Learn to write code and don't let a WYSIWYG be your interpreter!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top