function checkInputDate(obj){
var strDate=obj.value;
var re =/^(d{4})-(d{2})-(d{2})$/;
if(re.test(strDate))//判斷日期格式符合YYYY-MM-DD標准
{
var dateElement=new Date(RegExp.$1,parseInt(RegExp.$2,10)-1,RegExp.$3);
if(!((dateElement.getFullYear()==parseInt(RegExp.$1))&& ((dateElement.getMonth()+1)==parseInt(RegExp.$2,10))&& (dateElement.getDate()==parseInt(RegExp.$3))))//判斷日期邏輯
{
document.getElementById("errorMessage").innerText = "You can only input Date.(YYYY-MM-DD) !";
document.getElementById("error").style.display = "";
obj.value= ' ';
}
}else{
document.getElementById("errorMessage").innerText = "You can only input Date.(YYYY-MM-DD)!";
document.getElementById("error").style.display = "";
obj.value= '';
}
}