SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: When would this return FALSE?
-
Jul 15, 2007, 04:51 #1
- Join Date
- Nov 2006
- Posts
- 71
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
When would this return FALSE?
Hi all,
I'm analysing some different scripts to learn more about JavaScript. One thing I've noticed in a few of them is the following piece of code:
Code:if (document.getElementById && document.getElementsByTagName) { //stuff }
-
Jul 15, 2007, 05:44 #2
- Join Date
- Apr 2006
- Location
- Czech Republic
- Posts
- 236
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This should test if the DOM structure is completely loaded or not. It would return false in case the structure was incomplete yet.
-
Jul 15, 2007, 12:50 #3
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
It would return false if the person is using Internet Explorer 4, Netscape 4, or any other old browser that came out before those commands were introduced.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
Bookmarks