在页面判断起始时间是否大于结束时间
<tr><td>
<input id="start-time" type="text" name=""class="ipt tcal" name="date"/><span>到</span><input id="end-time" type="text" name="" value="" class="ipt tcal" name="date"/>
</td>
<td><input type="submit" value="确认搜索" class="btn-sm btn-info" onclick="check(start-time,end-time,)"/></td>
</tr>
<Script type="text/javaScript">
function check(startTime, endTime) {
if (startTime.length > 0 && endTime.length > 0) {
var startTmp = startTime.split("-");
var endTmp = endTime.split("-");
var sd = new Date(startTmp[0], startTmp[1], startTmp[2]);
var ed = new Date(endTmp[0], endTmp[1], endTmp[2]);
if (sd.getTime() > ed.getTime()) {
alert("开始日期不能大于结束日期");
return false;
}
}
return true;
}
</Script>