I know, no one in this forum cares, but just in case you use this area as a general purpose forum, here ya go, works like a champ.
function ValiDate(oTextBox)
{
//the values of these two strings are populated via an asp
//script that pulls start date and end date from my db table
var sd="8/25/2003"
var ed="10/25/2003"
//s,e and i are arrays ([2]=yyyy,[0]=mm,[1]=dd)
//s being the start date array
//e being the end date array
//i being the user input array
var s=sd.split('/')
var e=ed.split('/')
var i=oTextBox.value.split('/')
//create new date objects using constructed arrays
var startdate =new Date(s[2],s[0],s[1]);
var enddate=new Date(e[2],e[0],e[1]);
var inputdate=new Date(i[2],i[0],i[1]);
//run the comparison
if(inputdate.getTime() < startdate.getTime() || inputdate.getTime() > enddate.getTime())
{
alert("Both 'Assigned Date' and 'Due Date' must range between 8/25/2003 and 10/25/2003");
return false;
}
else
return true;
}
|