Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: credit card expiration date validation


Message #1 by slewitan@e... on Tue, 4 Jun 2002 20:56:45
Shouldn't the conditional read: if (d < dNow) ??

-----Original Message-----
From: slewitan@e... [mailto:slewitan@e...]
Sent: Tuesday, June 04, 2002 4:57 PM
To: javascript
Subject: [javascript] credit card expiration date validation


Hi All,
I am working on script for credit card expiration date validation it isn't 
working, any suggestions. Also I am concerned that the time of day will 
mess things up. I'm not concerned about time zones.
Thanks,
Sam
dYear = document.frmShipInfo.Card_ExpDate_Year.options
[document.frmShipInfo.Card_ExpDate_Year.selectedIndex].value

dMonth = document.frmShipInfo.Card_ExpDate_Month.options
[document.frmShipInfo.Card_ExpDate_Month.selectedIndex].value

dNow = new Date()
	
arryEndDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
d = new Date(dYear,dMonth-1,arryEndDays[dMonth-1]+1)	

if(d > dNow)
{
    alert("Your Credit Card has expired\n")	  
    return false
} 

  Return to Index