急,检测表单,怎么用JAVASCRIPT来比较两个日期。 http://expert.csdn.net/Expert/topic/2960/2960478.xml?temp=.4676782 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script>date1 = "2004-05-03"; //入住时间date2 = "2004-02-11"; //离店时间now = Date(); //现在时间s1 = Date.parse(date1.replace("-","/"));s2 = Date.parse(date2.replace("-","/"));s3 = Date.parse(now);if (s1>s2 || s1>s3) alert("输入有误");</script> <script language="javascript">function a(s1,s2){ d1 = new Date(s1); d1 = d1.getTime(); d2 = new Date(s2); d2 = d2.getTime(); return d2>d1}</script>日期格式:MM/DD/YYYY<br>Start:<input type=text name="txt1"><br>End:<input type=text name="txt2"><br><input type=button onclick="alert(a(document.all.txt1.value,document.all.txt2.value))"value="Test"> <script>function check(date1,date2){ now = Date(); //现在时间 s1 = Date.parse(date1.replace("-","/")); s2 = Date.parse(date2.replace("-","/")); s3 = Date.parse(now); if (s1>s2 || s1>s3) { alert("输入有误"); return false; } return true;}</script>Start:<input type=text name="txt1"><br>End:<input type=text name="txt2"><br><input type=button onclick="check(txt1.value,txt2.value)"value="Test"> towanghr100(灰豆宝宝.net) 那若是true就不要弹出窗口呀。要怎么改呀。thanks onclick="return a(txt1.value,txt2.value)" jquery有什么插件可以代替css3的box shadow 关于用script打印报“Error querying the default printer”的问题 My97DatePicker与界面样式好像起冲突 关于"钱"的校验 仿 IBM 导航 DIV没有设置ID属性,如何读取DIV中的innerHTML gmail中写邮件时附件的选择和显示是怎么实现的? 在线等 求JS大神解密JS 十万火急:关于树的问题 关于插入js特效的问题 我的Textbox框内有用户输入的本地文件地址,如何保存该文件到数据库? Netscape问题
date1 = "2004-05-03"; //入住时间
date2 = "2004-02-11"; //离店时间
now = Date(); //现在时间
s1 = Date.parse(date1.replace("-","/"));
s2 = Date.parse(date2.replace("-","/"));
s3 = Date.parse(now);
if (s1>s2 || s1>s3)
alert("输入有误");
</script>
function a(s1,s2)
{
d1 = new Date(s1);
d1 = d1.getTime();
d2 = new Date(s2);
d2 = d2.getTime();
return d2>d1
}
</script>
日期格式:MM/DD/YYYY
<br>
Start:<input type=text name="txt1">
<br>
End:<input type=text name="txt2">
<br>
<input type=button onclick="alert(a(document.all.txt1.value,document.all.txt2.value))"
value="Test">
function check(date1,date2)
{
now = Date(); //现在时间
s1 = Date.parse(date1.replace("-","/"));
s2 = Date.parse(date2.replace("-","/"));
s3 = Date.parse(now);
if (s1>s2 || s1>s3)
{
alert("输入有误");
return false;
}
return true;
}
</script>
Start:<input type=text name="txt1">
<br>
End:<input type=text name="txt2">
<br>
<input type=button onclick="check(txt1.value,txt2.value)"
value="Test">
towanghr100(灰豆宝宝.net) 那若是true就不要弹出窗口呀。
要怎么改呀。thanks