javascript - find out if I am 20 years before I can sustain myself on the side -


i have sat , work small jquery sciprt specify speed @ age , whether can laws create user.

<script type="text/javascript">      $(function() {     var today = new date();          var dd = today.getdate();      var mm = today.getmonth();     var yyyy = today.getfullyear();           $.datepicker.setdefaults( $.datepicker.regional[ "da" ] );           $("#datepicker").datepicker({                dateformat: 'yy-mm-dd',          changemonth: true,                   changeyear: true,         yearrange: '1950:'+yyyy,         maxdate: new date(yyyy, mm, dd),          onselect: function(value, ui) {                          var dob = new date(value);             var age = new date(today - dob).getfullyear() - 1970;             $('#age').html(age+' år gammel');              // alders kontrol             var status = (age<20)? true: false;                                      $('#msg').html( (! status )? '': 'kan ikke opret dig!' );             $("input[type=submit]").attr("disabled", status);          }     });      });      

from present day , 20 years behind can not select date must so. example if 19 years today , 20 tomorrow can first create me in morning see it.

so must first come forward , find out whether can create on site, if on 20 years must go on how old are,

the problem: shows years , dates , months today 1950. must take yearling away today , 20 years behind of 1993, last year promoting. should time have 20 years before have register on site.

change

 maxdate: new date(yyyy, mm, dd), 

to

  maxdate: new date(yyyy-20, mm, dd), 

demo here


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -