Back in 2004 when I wrote the first version of the falling Snow script, the standard DOM had just been finalised and was only supported by the latest version of Internet Explorer - IE5. The other two browsers in popular use at the time - Internet Explorer 4 and Netscape 4 - both had their own proprietary Document Object Models that they supported.
To get around the problem of the three most popular browsers at the time each supporting a different document object model we needed to include some code into the script that would test which of the document object models that the particular browser being used supported so as to use that when we needed to access the page content. While IE5 (and even the latest version of Internet Explorer) support the same DOM that IE4 did, we included all three in order to support the other browsers that were expected to (and did) follow that only support the standard DOM.
The following piece of code was incorporated into the 2004 version of my falling snow script (and most of the other scripts I wrote at that time) to handle this multiple DOM issue.
As all the popular modern browsers now support the standard DOM, we no longer need to consider the document.all and document.layers versions of the Document Object Model in writing our scripts. Any code that checks for either of those two DOMs in our scripts can therefore be safely deleted.
Of course having deleted that code (or its equivalent in whatever old script you are trying to update) we also need to recode all of the references to the findDOM function to simply call the standard DOM instead.In my original falling snow script there is only one call to this function that we need to replace.
objstyle = findDOM('snow'+i,1);
We simply replace that one statement with a direct call to the standard DOM using document.getElementById in order to update our script.
objstyle = document.getElementById('snow' + i).style;
While this particular script doesn't call findDOM with a 0 as the second parameter, the only difference needed in replacing the code where the call does have a zero there is to simply leave the .style off of the end of the call.
The new version of my "Falling Snow" script contains a number of additional calls to update the web page via the standard Document Object Model, however these are replacing other outdated code in the original script that was not done in that script with references to the Document Object Model.
Next: Accessing The BOM.
This article written by Stephen Chapman, Felgall Pty Ltd.