<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
function fn1(){
var year = prompt('请输入年份');
var res = fn2(year);
if(res){
alert('当前年份2月为29天')
}else{
alert('当前年份2月为28天')
}
}
fn1()
//判断是否是闰年
function fn2(a){
if(a%4==0&&a%100!=0||a%400==0){
return true
}else{
return false;
}
}
</script>
</body>
</html>
判断当前年份二月有多少天
最新推荐文章于 2023-02-25 17:21:27 发布