The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Help with Browser Detect Error

Okay, I'm less than fluent with JavaScript (I can do an alert and a pop-up window!). But I've managed to debug my problem. I didn't write this, I'm just trying to fix it. In the code below, the if statement checks to see if the browser is Netscape 4 and if so, subtract one from the users age becase the math is always one too high. Here is what I've determined.

IE6 Gets detected as Netscape 4 and does the subtraction making it 1 too low.

IE5x gets detected correctly and the script returns the correct age.

Netscape 4X Returns a Year too high

Netscape 6x Returns the correct age.

Below is the entire function. I've commented the lines that are causing the problem. It's just below this:
ERROR : The Below IF logic is where the ERROR is

// At this point insure that we have a four digit year.
if ( form.Year.value.length != 4 )
{
alert("Please check the year value, it must be either 2 or 4 digits.");
form.Year.focus();
return (false);
}

// Insure that the year is within 1890 and now
if ( form.Year.value >= 1890 && form.Year.value <= nThisYear )
{
// Set the hidden DOB field value