<!DOCTYPE HTML>
<html>
<body>
<script>
//获取起始日期

//转换为日期格式
var startDate='2016-06-02'.replace(/-/g,"/");
//获取结束日期

var endDate='2016-06-01'.replace(/-/g,"/");
console.log(1)
//如果起始日期大于结束日期
if(Date.parse(startDate)-Date.parse(endDate)>0){
 alert("起始日期要在结束日期之前!");
}
if(startDate>endDate)
{
alert("起始日期要在结束日期之前!");
}

if(new Date(startDate)-new Date(endDate)>0){
 alert("起始日期要在结束日期之前!");
}
</script>


</body>
</html>

相关文章:

  • 2022-12-23
  • 2021-11-21
  • 2022-02-12
  • 2021-11-16
  • 2021-08-20
猜你喜欢
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
相关资源
相似解决方案