Solved

javascript

Posted on 2006-07-03
2
212 Views
Last Modified: 2010-03-31
Hello can anyone help me please!!

In the following javascript code, but more speciffically the IF(TODAY == */*/1989 || TODAY == */*/1901).  What I am trying to do is allow the */* to be any number.  So what I am checking is that if TODAY is equal to <any number>/<any number>/1989 or <any number>/<any number>/1901 then an alert should be given.  

Thanks in advance!

function CHECKFORM() {
        var TODAY = new Date()
        TODAY = Date.parse(TODAY)
        var BIRTHDAY = document.forms[0].BIRTHDAY.value
       
        if (!isDate(BIRTHDAY)) {
            alert("PROVIDE A VALID DATE.  Format = mm/dd/yyyy")
            return false
        }
       
        BIRTHDAY = Date.parse(BIRTHDAY)
       
        if (TODAY == */*/1989 || TODAY == */*/1901) {
            alert("Sorry, you need to be at least 18 years of age, but younger then 105")
            return false
        }
        return true
    }
0
Comment
Question by:meaar
2 Comments
 
LVL 92

Expert Comment

by:objects
ID: 17034484
you'd be better of asking in the javascipt ta
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/
0
 
LVL 10

Accepted Solution

by:
mukundha_expert earned 500 total points
ID: 17034673
You can get the year like this,

      var TODAY = new Date()
        //TODAY = Date.parse(TODAY)
        day = TODAY.getDay() ;
        month = TODAY.getYear () ;
        year = TODAY.getYear () ;

compare the year to the year you wanted, else subtract it from the birthday's year to find whether the user is 18 years above age
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
@SBGen Method 3 38
Requested array size exceeds VM limit 3 84
Java JRE greater than 1.6 5 50
oracle 11g 23 50
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now