|
-
Jan 23rd, 2003, 03:08 PM
#1
Thread Starter
Junior Member
OnLoad... will it REALLY wait?
I'm wondering... I'm using a document_onLoad() sub procedure (vbscript)... my intent is that I need it to wait until the page completely loads before it continues...
there is a link on the page that is disabled... and I want to be sure the page loads before I start a script that enables the link. My question is... does anyone know if onLoad will wait till EVERYTHING on the page loads? Including objects (activex)... if necessary, and pre-cached images?
Here's my code...
Code:
<style>
<!--
#myDiv1 {font-family: verdana; color: red;}
#myDiv2 {font-family: verdana; color: blue;}
-->
</style>
<SCRIPT LANGUAGE="javascript">
Image1= new Image(50,60)
Image1.src = "test1.bmp"
Image2= new Image(70,80)
Image2.src = "test2.bmp"
Image3= new Image(70,80)
Image3.src = "test3.bmp"
Image4= new Image(70,80)
Image4.src = "test4.bmp"
Image5= new Image(70,80)
Image5.src = "test5.bmp"
Image6= new Image(70,80)
Image6.src = "test6.bmp"
</SCRIPT>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
sub Window_OnLoad()
'window.open "http://www.espn.com"
msgbox "Site Has Finished Loading"
myDiv2.style.visibility = "hidden"
myDiv1.style.visibility = "visible"
end sub
</SCRIPT>
' all that is in <head></head>
' this is in body
<font face="Verdana" size="2">
<div id="myDiv1" style="position: absolute;visibility: hidden;">
<a href="<%=gstrURL%>ActiveOlap/axdActiveOLAP.vbd?...wholebiglongurlhere">Application Loaded! Begin Forecasting</a>
</div>
<div id="myDiv2" style="position: absolute;">
Please Wait While Application Downloads...
</div>
</font>
This "functions" but it loads so fast I can't tell if it really waits till the images load... they're big images... but they're local... I'm usign the images to tell if it will load them and THEN pop up the dialog and fix the link...
Rock
-
Jan 23rd, 2003, 03:25 PM
#2
PowerPoster
Guess that shd work, else u can put the onload part right at the bottom in just script tags...would work only in IE though
-
Jan 24th, 2003, 05:40 AM
#3
Frenzied Member
Yes it is supposed to be called when everything has finished loading (or the user presses stop).
-
Jan 24th, 2003, 06:33 AM
#4
Lively Member
<SCRIPT FOR=document EVENT=onreadystatechange>
if (this.readyState == 'complete')
{
// perform some action
}
</SCRIPT>
Works like a champ... Then you know everything is loaded, you can continue....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|