<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>a</title><script type="text/javascript">
function check(){
var year = document.getElementById('txt').value;
var str = ((year % 4 ==0) && (year % 100 != 0) || (year % 400 ==0)) ? 1 : 0;//1闰年0非闰年
alert(str)}</script>
</head>
<body>
<input type="text" value="2008" id="txt"><input type="button" value="ok" onclick="check()">
</body>
</html>