User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,478 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,795 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1445 | Replies: 5
Reply
Join Date: Aug 2007
Posts: 12
Reputation: yasserstein is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
yasserstein yasserstein is offline Offline
Newbie Poster

controls rendering time

  #1  
Aug 30th, 2007
hi,
i've set up several javascript effects on my page, so now i need some controls to have completely loaded before the user can interact with the page. how can i control the rendering times?
thanks.
yasser.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 971
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 48
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is online now Online
Posting Shark

Re: controls rendering time

  #2  
Aug 30th, 2007
strictly, you can't. browsers seem to have their own rendering order, and this can change depending on the document type of the page being rendered.

you can 'hide' a page's content until the page raises the 'onload' event, which should be done when the page has been fully 'loaded' into the browser, at this point, it should be possible for it to be rendered instantaneously..
  1. <html>
  2. <head>
  3. </head>
  4. <body style="display:none;" onload="this.style.display='';">
  5. <img src="some_huge_image.bmp"/>
  6. </body>
  7. </html>
This has the disadvantage that, the user sees nothing until the page has loaded..
Plato forgot the nullahedron..
Reply With Quote  
Join Date: Aug 2007
Posts: 12
Reputation: yasserstein is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
yasserstein yasserstein is offline Offline
Newbie Poster

Re: controls rendering time

  #3  
Aug 30th, 2007
i see. what if i use this very property - display - to delay the display of certain controls?
can i do that?
thanks.
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 971
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 48
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is online now Online
Posting Shark

Re: controls rendering time

  #4  
Aug 30th, 2007
you can use it to control the display of anything, it hides the element it is applied to and all elements that are descendants of that element.

if you were hiding another element, you'd have to use the getElementById( ) function or similar in the body onload event to get hold of the element to re-display.

But, there is only an onload event on the html>body element. There isn't one for every element on the page. The body onload is raised ( in theory ) when everything in the document has been loaded.. exactly what that means isn't particularly well defined.

if you place a script element some way down the code in a page, it's pretty safe to assume that the script in it will be executed after all of the document above that point has been loaded. ( but loaded is not the same as rendered ). i.e, in the same vein as the previous example:
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <img id="img1" style="display:none;" src="some_huge_image.bmp"/>
  6. <script type="text/javascript">
  7. document.getElementById( 'img1').style.display='';
  8. </script>
  9. </body>
  10. </html>
In this case, it's pretty much certain that the script will execute when the <img/> tag has been interpretted and is ready to be rendered, or perhaps even has been rendered. But the image will not neccessarily have been sourced ( i.e. the actual image data might still be being downloaded when the script runs ), because most browsers push that task to 'after' the page has been rendered.

Whats the 'type' of thing that you want to wait for? Is it loading images, code, style, something dynamic ( i.e. ajax ), animation/movie, activex, or something else?
Plato forgot the nullahedron..
Reply With Quote  
Join Date: Aug 2007
Posts: 12
Reputation: yasserstein is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
yasserstein yasserstein is offline Offline
Newbie Poster

Re: controls rendering time

  #5  
Aug 31st, 2007
my page has several image controls on it. the problem with this is that i'm including a javascript code off dynamicdrive.com for a slideshow. the slideshow will typically start whenever the user clicks any image.
the problem is that if the user clicks an image so early that the page has not finished download all the images yet, that image is displayed alone in a new page, which is not what i want.
i want all images to finish downloading before the user gets to click any of them.
so i guess that's doable by using the
onload="this.style.display='';"
body event.. what do you think?
thanks
yasser.
Reply With Quote  
Join Date: Jan 2007
Posts: 2,604
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 119
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: controls rendering time

  #6  
Sep 2nd, 2007
One thing you could do is put a name link to the same page in (instead of the real link), and then, have javascript change the link to the real link.
Daylight-saving time uses more gasoline
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 2:39 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC