Link to home
Start Free TrialLog in
Avatar of jasimon9
jasimon9Flag for United States of America

asked on

Firefox y2K issue?

I have a strange difference in behavior between IE and Firefox. I am using some Javascript to process a field entry, and the date calcualtions in Firefox appear to be inccorect. Here is the Javascript function:

function ConfirmInactivate(theDate)
{
   var oDate = document.getElementById(theDate);
   var today = new Date();
   oDate.value = (today.getMonth() + 1) + '/' + today.getDate() + '/' + today.getYear();
   if (document.theForm.Status.value == "I")
   {
      return(confirm("Are you sure you want to Inactivate your account?\n\nThis will mean that you will no longer be active in the RepHunter.net\ndatabase, and that you will not be able to log in to your account?"));
   }
}

This code is triggered via the ONCHANGE attrbitute of a SELECT. A side effect of the function is to change the value of a date field, with the formal parameter "theDate".

In IE, the field is populated with a value such as '5/2/2005'. However, in Firefox, the field is populated with the value '5/2/105', which leads to an SQL Server error when trying to write into a date field.

Can anyone give me the fix for this?
ASKER CERTIFIED SOLUTION
Avatar of GwynforWeb
GwynforWeb
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jasimon9

ASKER

This certainly does the job. Points awarded.
thx for the points