<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

</head>

<body>

</body>

<script type="text/javascript">

var year=prompt("请输入年份");//弹出输入框

var a1=year%4==0;

var a2=year%100!=0;

var a3=year%400==0;

var result=(a1&&a2)||a3?"该年是闰年":"该年的平年";//三目运算符

alert(result);

 </script>

</html>

posted on 2016-10-22 15:48  代码小公主  阅读(13595)  评论(0编辑  收藏  举报