Javascript日常小技巧收集
- 日期函数
- 日期转换 Date.parse();
- 日期比较:在转换的时候要注意正确方可比较日期,一般日期不能比较是格式转换错误所以无法比较function ValidtorTime()
{
var d1 = new Date(document.getElementById('txbFromDate').value.replace(//-/g, "//"));
var d2 = new Date(document.getElementById('txbToDate').value.replace(//-/g, "//"));
if(d1>d2)
{
alert("结束时间必须在开始时间之后!");
return false;
}
return true;
}