D
Dale
Hi Everyone,
I've got a form that provides a pop-up calendar for users to select
dates for requesting jobs to be completed. The calendar works great,
but it unfortunately allows users to select dates earlier than today
(which they should't be allowed to do). I've started coding some
validation scripts, but I'm stuck now and my approach doesn't seem to be
working.
I've Googled all morning looking for an answer and couldn't find one and
I searched the newsgroups as well. Below is my code:
<html>
<script language="JavaScript" type="text/javascript">
<!--
var now = new Date(); // Create a new Date Object
var day = now.getDay(); // day returns integer of 0-6 which will be
stored in the variable day
var month = now.getMonth(); // month returns integer of 0-11 which will
be stored in the variable month
var date = now.getDate(); // day returns integer of 1-31 which will be
stored in the variable date
var year = now.getYear();
if (year < 2000) year += 1900
var tom = new Date("December 9, 2003");
var newday = tom.getDay();
var newmonth = tom.getMonth();
var newyear = tom.getYear();
document.write("Now is <b>" + now + "<br>");
document.write("Today is: <b>" + month+date+year + "<br>");
document.write("Today is: <b>" + month + "/" + date + "/" + year +
"</b><br>");
document.write("Var date is <b>" + tom + "<br>");
document.write("Var day is <b> " + newday + "<br>");
document.write("Var month is <b> " + newmonth + "<br>");
document.write("Var year is <b> " + newyear + "<br>");
-->
</script>
<form method="post" name="data" onSubmit="return isitToday()">
<input type="text" name= "mydate">
<input type="submit" value="Check">
</form>
</html>
Thanks!
I've got a form that provides a pop-up calendar for users to select
dates for requesting jobs to be completed. The calendar works great,
but it unfortunately allows users to select dates earlier than today
(which they should't be allowed to do). I've started coding some
validation scripts, but I'm stuck now and my approach doesn't seem to be
working.
I've Googled all morning looking for an answer and couldn't find one and
I searched the newsgroups as well. Below is my code:
<html>
<script language="JavaScript" type="text/javascript">
<!--
var now = new Date(); // Create a new Date Object
var day = now.getDay(); // day returns integer of 0-6 which will be
stored in the variable day
var month = now.getMonth(); // month returns integer of 0-11 which will
be stored in the variable month
var date = now.getDate(); // day returns integer of 1-31 which will be
stored in the variable date
var year = now.getYear();
if (year < 2000) year += 1900
var tom = new Date("December 9, 2003");
var newday = tom.getDay();
var newmonth = tom.getMonth();
var newyear = tom.getYear();
document.write("Now is <b>" + now + "<br>");
document.write("Today is: <b>" + month+date+year + "<br>");
document.write("Today is: <b>" + month + "/" + date + "/" + year +
"</b><br>");
document.write("Var date is <b>" + tom + "<br>");
document.write("Var day is <b> " + newday + "<br>");
document.write("Var month is <b> " + newmonth + "<br>");
document.write("Var year is <b> " + newyear + "<br>");
-->
</script>
<form method="post" name="data" onSubmit="return isitToday()">
<input type="text" name= "mydate">
<input type="submit" value="Check">
</form>
</html>
Thanks!