473,320 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

document.all vs. document.layers

As I understand it, document.layers only works in Netscape 4+ (ie. it
doesn't work in any version of Internet Explorer), while document.all
only works in Internet Explorer 4+ (ie. it doesn't work in any version
of Netscape). Is that correct?

Also, what about document.getElementById? When did Internet Explorer
start supporting that and when did Netscape start supporting that?

I ask because I'm wondering how necessary doing something similar to
the following is:

if(document.getElementById)
obj = document.getElementById(id);
else if(document.all)
obj = document.all[id];
else if(document.layers)
obj = document.layers[id];
else
return 1;

Dec 24 '05 #1
2 2568
yawnmoth wrote:
As I understand it, document.layers only works in Netscape 4+
No, it only works in Netscape 4.x. Netscape 6 onwards do not support it.
(ie. it doesn't work in any version of Internet Explorer), while
document.all only works in Internet Explorer 4+ (ie. it doesn't work in
any version of Netscape). Is that correct?
No. document.all is supported by quite a lot of things, but most browsers
claim that they don't when you test for it (on the principles of (a) if you
test for it then you are hopefully also testing for the standard DOM and
(b) many people test for it and then assume the browser is IE).
Also, what about document.getElementById?
This is the standard.
When did Internet Explorer start supporting that and when did Netscape
start supporting that?
Versions 5 and 6 respectively IIRC.

There is more to the WWW then IE and NS though, Netscape is not a very
common browser these days. There is also Firefox, Opera, Konqueror, Safari,
and so on.
I ask because I'm wondering how necessary doing something similar to
the following is


Depends on how far back you want to support. Personally I find that sticking
to the standard DOM is enough and older browsers can get the fallback code.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Dec 24 '05 #2
On 24/12/2005 09:16, David Dorward wrote:
yawnmoth wrote:
As I understand it, document.layers only works in Netscape 4+


No, it only works in Netscape 4.x.


A minor note: not only NN4. There are one or two other browsers that
implement it. OmniWeb, for example. There's a post in the archives
somewhere...

<http://groups.google.co.uk/group/comp.lang.javascript/browse_frm/thread/ab32477a92514e24/a64d489104046c6f#a64d489104046c6f>

[snip]

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Dec 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris Leonard | last post by:
Hi. Can anyone help me please. If the syntax for IE is: document.getElementById(layerID) What if I want to use layers ? document.layers ?????????
6
by: David List | last post by:
I'm having a problem using different properties of the document object in the example javascripts in my textbook with browsers that identify themselves as using the Mozilla engine. One example of...
3
by: Crimefighter | last post by:
I'm not a javascript guy, but the use of this banner rotator script has given me fits. I know a few causes of the problem thus far, one being the layer tags aren't supported under Netscape 7.1...
12
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
3
by: InvisibleMan | last post by:
Thanks in Advance for any help on this - its truely sending my head in loops... so I appreciate your efforts! okay, I have a javascript listed below that drops down submenus contained within:...
10
by: InvisibleMan | last post by:
Hi, Thanks for any help in advance... Okay, I have the JS listed below that calls for the display of the (DIV) tag... cookie function not included, as don't feel its necessary but you'll get the...
4
by: ashkaan57 | last post by:
Hi, I am using the following code to show/hide part of an html page. It works in Netscape and Firefox but dies in IE: "Error: document.layers is null or not an object" <style> ..noshow {...
6
by: Aaron Gray | last post by:
Hi, I know the 'document.getElementById()' issue is really over since every browser since 1998 supports the W3C DOM standard, but I could not resist this offering :- if...
7
by: sunny1009 | last post by:
Hi Guys, Can you please check this code and see whats wrong with it?? I am getting document.all.style is null or not an object error. Any help will be really appreciated. Thanks Code...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.