chaddu1256
IS-IT--Management
<%
java.util.Calendar today = java.util.Calendar.getInstance();
int thisYear = today.get(java.util.Calendar.YEAR);
int thisMonth = today.get(java.util.Calendar.MONTH);
%>
<script language="javascript">
function validate(ccfrm){
var year=<%=thisYear%>;
var month=<%=thisMonth%>;
if(ccfrm.expYear.options[ccfrm.expYear.selectedIndex].value < year){
alert("Invalid Expiration Date");
return false;
}
else if(ccfrm.expYear.options[ccfrm.expYear.selectedIndex].value = year){
if(ccfrm.expMonth.options[ccfrm.expMonth.selectedIndex].value <= month){
alert("Invalid Expiration Date");
return false;
}
}
}
</script>
We have this code here that we are trying to use to validate wether someone entered a valid expiration date for a credit card. When someone gets to this page though and we view the source, for some reason its pulling var year=2004; and var month=1; We cant figure out why its pulling the var month as 1. The system date on the web server is Feb 27, 2004 so that is correct. Anyone know why it would be pulling the date in as 1?
java.util.Calendar today = java.util.Calendar.getInstance();
int thisYear = today.get(java.util.Calendar.YEAR);
int thisMonth = today.get(java.util.Calendar.MONTH);
%>
<script language="javascript">
function validate(ccfrm){
var year=<%=thisYear%>;
var month=<%=thisMonth%>;
if(ccfrm.expYear.options[ccfrm.expYear.selectedIndex].value < year){
alert("Invalid Expiration Date");
return false;
}
else if(ccfrm.expYear.options[ccfrm.expYear.selectedIndex].value = year){
if(ccfrm.expMonth.options[ccfrm.expMonth.selectedIndex].value <= month){
alert("Invalid Expiration Date");
return false;
}
}
}
</script>
We have this code here that we are trying to use to validate wether someone entered a valid expiration date for a credit card. When someone gets to this page though and we view the source, for some reason its pulling var year=2004; and var month=1; We cant figure out why its pulling the var month as 1. The system date on the web server is Feb 27, 2004 so that is correct. Anyone know why it would be pulling the date in as 1?