Forum Moderators: open
function todaytxt() {
var Today=new Date();
return Today.getMonth()+1+"/"+Today.getDate()+"/"+Today.getFullYear();
and within the <body> i have
Date: <input class="numbers" name="formdate" size="10" disabled>
now my problem is, i have a form where i want people to put a valid date in, which isnt prior to current date and no longer than 30days after current date, but i have no idea how to go about this, any help would be appreciated.
Server-side scripting is the best way to do it.
Sorry I didn't really answer your question.
Birdman
PS: Welcome to Webmaster World!
In your question, I'ld do the following:
var lowDate = new Date();
lowDate.setHours(0); lowDate.setMinutes(0); lowDate.setSeconds(0);
var highDate = new Date(lowDate.getTime()+31*834000);
currentDate = new Date(formYear,formMonth,formDay,12,0,0)
var validDate =
(lowDate.getTime()<currentDate.getTime() &&
currentDate.getTime()<highDate.getTime())
? true : false ;
A reference to the various constructors, properties and methods of the Date object in java/ecma-script can be found here: [devguru.com...]