checking for at least 18 years old

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laredotornado

    checking for at least 18 years old

    Hi,

    Given select menus named birthMonth, birthDay, and birthYear, how do I
    check if the user has selected values such that he/she is at least 18
    years old?

    Thanks, - Dave
  • Evertjan.

    #2
    Re: checking for at least 18 years old

    laredotornado wrote on 04 apr 2008 in comp.lang.javas cript:
    Given select menus named birthMonth, birthDay, and birthYear, how do I
    check if the user has selected values such that he/she is at least 18
    years old?
    You cannot, she/he could be lying.

    It is much easier to just ask:

    "Are you at least 18 years old?"

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Jeremy J Starcher

      #3
      Re: checking for at least 18 years old

      On Fri, 04 Apr 2008 13:19:12 -0700, laredotornado wrote:
      Hi,
      >
      Given select menus named birthMonth, birthDay, and birthYear, how do I
      check if the user has selected values such that he/she is at least 18
      years old?
      >
      Thanks, - Dave
      Like the others said, you can't.

      If you must, you can get the system date from Javascript and extract out
      the day and month and compare those values, then compare the year.

      Its not worth the effort, however. Any time I see one of those boxes I
      just put my mouse over the 'year' select box and start scrolling down
      till I know I'm in the clear. I suspect that most users will do
      something similar.

      Even if you could be 100% sure they would enter their actual birthday,
      you *still* can't trust it. Unless you are going to get the time/date
      from another source, the system clock can be changed. In less than a
      dozen mouse clicks I can have my machine thinking its 2040.

      Comment

      Working...