Javascript:
function ValidDate(y, m, d)
{ // m = 0..11 ; y m d integers, y!=0
with (new Date(y, m, d))
return (getMonth()==m && getDate()==d); /* was y, m */
}
Javascript:
function ValidDate(y, m, d)
{ // m = 0..11 ; y m d integers, y!=0
with (new Date(y, m, d))
return (getMonth()==m && getDate()==d); /* was y, m */
}
简单的:
function ValidDate(y, m, d) {
var date = new Date(y, m, d);
return date.getMonth() == m && date.getDate() == d;
}
with
使其this
范围是中的语句,with
因此您不必做任何事情.functionName(...)
你可以做什么:
function ValidDate(y, m, d)
{ // m = 0..11 ; y m d integers, y!=0
var date = new Date(y, m, d);
return (date.getMonth()==m && date.getDate()==d); /* was y, m */
}