function CompareDate(inputDate){
var currentDate = new Date();
if(currentDate.getYear() > inputDate.getYear())
return -1;
else if(currentDate.getYear() < inputDate.getYear())
return 1;
if(currentDate.getMonth() > inputDate.getMonth())
return -1;
else if(currentDate.getMonth() < inputDate.getMonth())
return 1;
if(currentDate.getDate() > inputDate.getDate())
return -1;
else if(currentDate.getDate() < inputDate.getDate())
return 1;
return 0;
}
function Compare() {
var sday = document.getElementById("day").value.split('-');
var inputDate = new Date(sday[0],sday[1]-1,sday[2]);
if(isNaN(inputDate)){
alert("不是日期");
return;
}
var result = CompareDate(inputDate);
if(result < 0)
alert(inputDate.toLocaleString() + "小于当前日期");
else if(result > 0)
alert(inputDate.toLocaleString() + "大于当前日期");
else
alert(inputDate.toLocaleString() + "等于当前日期");
}