JavaScript versions: is it worth learning all of them?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

OK, there appear to be three major Document Object Models for
DHTML and JavaScript,
   document.layers          -- Netscape
   document.all             -- Micro$oft
   document.GetElementById  -- W3C (used by Firefox, etc.)

Trying to find information on the document.layers model, I continuously
get directed to one  or another page: /
which has stopped responding to http queries some time ago.  (Lynx just
times out trying to connect.)

Micro$oft's site either has no downloadable references or they make them
very hard to find.  Instead, it is necessary to navigate through a maze of
pages, one for each object, method, function, style, property, keyword or
whatever that they support with their version of JavaScript -- thousands
and thousands and thousands of tiny little pages.

Finding JavaScript references that don't refer only to Netscape's and/or
Micro$oft's implementations was a bit difficult but I eventually did find
it W3C's DOM in downloadable format and have used the information in that
to create JavaScript versions of the sliding-block puzzles[1] I designed.

I thought it would be nice to support *all* browsers but then have
learned from several sources that Netscape's new browser version
is selectable to emulate Firefox or IE.  No mention is made of it
supporting the old Netscape standard.  Then I found out in a newsgroup
for the handicapped that Internet Explorer version 6 now supports the
document.GetElementById model and that my puzzles work with IE 6.

That suggests that it may be pointless to bother learning anything but
the W3C DOM.

So, should I bother at all to try to learn the document.layers and
document.all methods of implementing DHTML or will the W3C DOM become
supported enough that the other models become superfluous?

Norman De Forest             [=||=]            (A Speech Friendly Site)
Q.  Which is the greater problem in the world today, ignorance or apathy?
A.  I don't know and I couldn't care less.

Re: JavaScript versions: is it worth learning all of them?

Norman L. DeForest wrote:
Quoted text here. Click to load it

The Netscape referred to is NN4, not later versions.  Don't bother
spending a lot of time catering to this ancient browser.

Modern versions of Internet Explorer also use document.getElementById.

It is quite easy to deal with older versions of Internet Explorer that
require use of document.all.  I use this function to access objects via ID:

// getObject - get object associated with an ID, or null if no object
function getObject ( id )
    if ( id == "" )
        return( null );
    if ( document.getElementById && (obj = document.getElementById(id)) )
    else if ( document.all && (obj = document.all[id]) )
    else /* DOM not supported, or no object */
        return( null );
    return( obj );

If you use such a function to get objects via ID, browser differences in
this regard become irrelevant.

Quoted text here. Click to load it

No, use the W3C DOM, but use a good DHTML reference book to help you
deal with browser differences.

Re: JavaScript versions: is it worth learning all of them?

Writing in news:alt.www.webmaster
 From the safety of the ISINet, Nova Scotia cafeteria

Quoted text here. Click to load it

IMO that is the best course of action unless you /need/ to support a  
particular browser and then you must, of course, learn it's deviations

William Tasso

Site Timeline