While you cannot tell for certain just what the quality of the script is, there are a number of things you can quickly search for in the script that will eliminate a lot of the junk and older scripts written for early browsers. There are also a few simple things to search for that will help you to choose between two scripts.
- document.layers and document.all were for use in Netscape 4 and Internet Explorer 4 respectively and all more modern browsers use document.getElementById instead.
- document.write became obsolete when Netscape 4 died - all more modern browsers provide far better ways to interact with the web page.
So having eliminated at least a good portion of the junk, you may still have a selection of alternative scripts to choose between that all appear to do what you want. Ideally you want to choose the version that is the least obtrusive (involves the minimum changes to your page to attach it and doesn't interfere with other scripts you attach to the same page). The following are some of the things to help you compare scripts so as to choose the one that is more likely to be the better written one.
- If you can't find anything in the scripts you are comparing that helps you choose between them then look for other scripts written by the same authors. If some of an author's other scripts contain indications of more modern coding then the author will be more likely to produce an updated version of the script in the future.
By doing these few simple searches you will be far more likely to select scripts to use with your web pages that will work properly with current and future browsers and which are less likely to interfere with one another if you attach two to the same page. You may still end up with a script that isn't the best one available that does what you want it to do (you may not have even found that one) but at least you will have discarded some of the junk scripts and chosen one that is amongst the better ones that you found.
This article written by Stephen Chapman, Felgall Pty Ltd.