•
•
•
•
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 425,933 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 1,632 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: 1328 | Replies: 5
![]() |
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 963
Reputation:
Rep Power: 5
Solved Threads: 48
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..
This has the disadvantage that, the user sees nothing until the page has loaded..
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..
HTML Syntax (Toggle Plain Text)
<html> <head> </head> <body style="display:none;" onload="this.style.display='';"> <img src="some_huge_image.bmp"/> </body> </html>
If it only works in Internet Explorer; it doesn't work.
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 963
Reputation:
Rep Power: 5
Solved Threads: 48
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:
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?
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:
HTML Syntax (Toggle Plain Text)
<html> <head> </head> <body> <img id="img1" style="display:none;" src="some_huge_image.bmp"/> <script type="text/javascript"> document.getElementById( 'img1').style.display=''; </script> </body> </html>
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?
If it only works in Internet Explorer; it doesn't work.
•
•
Join Date: Aug 2007
Posts: 12
Reputation:
Rep Power: 2
Solved Threads: 0
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 body event.. what do you think?
thanks
yasser.
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='';"
thanks

yasser.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Button to open a new browser window (ASP.NET)
- dynamically adding controls to report (Visual Basic 4 / 5 / 6)
- Very Very Urgent...Need Code for Calculating Execution Time For Jsp Page (JSP)
- Drag and Drop the controls using .net 3.0+WPF (C#)
- Getting values from GridView Controls (ASP.NET)
- How can I fill the webpage (ASP.NET)
- Sound problem in Windows XP (Windows NT / 2000 / XP / 2003)
- need to control my computer via my mobile phone (Peripherals)
- Hijack this log (Viruses, Spyware and other Nasties)
- hahahaha (Troubleshooting Dead Machines)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: article browser?
- Next Thread: Edit options in sendmail command



Linear Mode