aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes using date with value from dropdown box? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "using date with value from dropdown box?" Watch "using date with value from dropdown box?" New topic
Author

using date with value from dropdown box?

Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
I'm trying to get the month and year from 2 dropdownboxes and compare them with today's date(month and year) It fails every date input
var today = new Date();
var month = today.getMonth();
var year = today.getYear();
var mon = document.charge.month.value

var yr = document.charge.year.value
mon = mon - 1

submitOK = "true"

else if (year > yr)
{
alert("Your card is expired")
submitOK="false"

}
else ((year == yr)&&(month > mon))
{
alert("Your card is expired")
submitOK="false"
}
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
This is a string document.charge.year.value not a number.

Eric
Donna Bachner
Ranch Hand

Joined: Oct 08, 2004
Posts: 109
thanks, I used parse int on my values from the dropdownbox and changed the values a little and it worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using date with value from dropdown box?