Results 1 to 4 of 4

Thread: OnLoad... will it REALLY wait?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Tulsa, OK
    Posts
    24

    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

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    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

  3. #3
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    Yes it is supposed to be called when everything has finished loading (or the user presses stop).

  4. #4
    Lively Member
    Join Date
    Mar 2002
    Location
    S.A
    Posts
    89
    <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....
    I forgot my password....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width