今天修改一处通过input输入框输入的时间,之前使用type=“time”,只可以显示出时/分,显示不出来秒;经过修改为type=“datetime-local” step="01"年月日时分秒都可以显示,或者type=“time” step="01"只显示时分秒;效果如下:
开始时间:<td style="padding-left:2px;"><input name="start" id="start" value="${pd.start}" type="datetime-local" step="01" style="width:200px;height: 25px;" title="开始时间"/></td>
结束时间:<td style="padding-left:2px;"><input name="end" id="end" value="${pd.end}" onchange="stoe()" type="datetime-local" step="01" style="width:200px;height: 25px;" title="结束时间"/></td>
对结束时间和开始时间的一个对比
function stoe() {
var s = $("#start").val();
//console.log(s);
var e = $("#end").val();
//console.log(e);
if(e < s){
alert("结束时间不能大于开始时间!")
$("#end").attr("value","");
}