?
Solved

javascript

Posted on 2006-07-03
2
Medium Priority
?
217 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 2000 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

765 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