The idea behind these scripts is that you can then write scripts along the lines of...
The problem with this method is that it's unreliable. For it to work the programmer must know exactly which browsers support which functions and the browser detect script must be able to correctly identify the browser in question. This is made more difficult by the fact that a number of browsers falsely report their identity in an attempt to run poorly written scripts that implement browser detects.
An example of this would be getting a reference to an object with a certain id. The modern method is to use the document.getElementById method, but this is unsupported by older browsers. There are 2 older methods, document.all and document.layers are arrays used in some older browsers to reference elements by id, but these are not supported by a number of modern browsers.
The browser detect method of handling might look as follows..
A much more simple and robust solution is to use object detection.
In this case the if statement is based on whether the browser recognises the document.getElementById object. If the browser supports it the getElementById will be used, otherwise it will try the document.all method. If it doesn't find that it will attempt to use the the document.layers method. This solution has the added advantage that it doesn't require ongoing maintaince. If a new browser is released this script will continue to work.
document.all and document.layers are pretty archaic and in most cases you won't need them. However if you want to support older browsers and don't want to spoil your pretty code by putting if statements everywhere to handle this issue there is a very elegant solution.
You can do an object detect right at the start of your code for the document.getElementById method and if it doesn't exist you can add it yourself. Here's the code that will do it.
Then you can happily use document.getElementById throughout your code.