There is something wrong with this JavaScript -


I have developed a script for checking the user who selected a valid month and year for credit card is.

  Validate the function () {var dt = new date (); Var mth = dt.getMonth (); Var yr = dt.getYear (); // It returns different data in different browsers yr = yr + 1900; If (eval (document.PurchaseCredit.cc_expire_month.value) & lt; mth & amp; eval (document.PurchaseCredit.cc_expire_year.value) == yr) {document.getElementById ('Error'). InnerHTML = "The end date can not be less than the current date."; Document.forms ['purchase credit']. Submit.disabled = true; } And {document.getElementById ('Error'). InnerHTML = ""; Document.forms ['purchase credit']. Submit.disabled = false; }}  

This script works well in Firefox but does not work in IE7. Why?

This is not working because getyear () returns different results for different browsers.

Internet Explorer:

  * Returns four digits for the year before 1900 and after 1999.  

Firefox:

  * Returns less than 0 values ​​for the year before 1900. For example,  

Returns the value of the year 1800 for 100 years or more for equal years of 100 * 2000 or more. For example, return of the year 2008 is 108.

Html>

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -