求大神帮忙Javascript算法编程, 判断是否是闰年

如题所述

请输入年份:<input id=yy type=text value="" /><button onclick="isyun();">判断是否闰年</button>
<script>
function isyun(){
if(yy.value!=""){
var d=new Date(yy.value,2,0);
if(d.getDate()==29){
alert(yy.value+"年是闰年!");
}else{
alert(yy.value+"年是平年!");
};
}
}
</script>
温馨提示:答案为网友推荐,仅供参考
相似回答