This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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?
 
Similar Threads
problems during validation
Struts Validator FrameWork = JavaScript Error
Date comparision
VERY urgent help me please
can form names b passed as parameters to javascript