Hi all,
May I ask a javascript question?? (sorry to post
here!) below is a form checking input date. The input
date cann't be earlier than today. But it also
compares hours and minutes which I don't want.
Suppose you input 08/20/2003, it thinks it's
08/20/2003 00:00:00 which is earlier than now
(08/20/2003 15:30:00). How to solve this?? Thank you!
<html>
<head>
<script>
function validate(){
var obj = document.forms("shipping");
//$$ sending date cannot be earlier than today
now = new Date();
sDate = obj.p_sending_date.value;
sDate = sDate.substring(0,2) + "/" +
sDate.substring(3,5) + "/" + sDate.substring(6,10);
inputDate = new Date(sDate);
if (inputDate < now) {
alert("Sending date cannot be earlier
than today.");
}else{
alert("ok");
}
}
</script>
</head>
<body>
<form name="shipping">
<input type=text name="p_sending_date">
<input type=submit value="submit"
onClick="validate();">
</form>
</body>
</html>
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Andrea Oracle
INET: [EMAIL PROTECTED]
Fat City Network Services -- 858-538-5051 http://www.fatcity.com
San Diego, California -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).