Solved

javascript

Posted on 2006-07-03
2
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

696 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