js判断闰年(闰年计算方法)
例子,js 判断闰年的实现代码。
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>判断闰年_www.jquerycn.cn</title>
<script type="text/javascript" languge="javascript">
//能被4整除且不能被100整除
//或
//能被100整除且能被400整除
function isLeapYear(){
var pYear=window.myForm.theYear.value;
if(!isNaN(parseInt(pYear))){
if((pYear%4==0 && pYear%100!=0)||(pYear%100==0 && pYear%400==0)){
window.alert(pYear+"是闰年!");
}else{
window.alert(pYear+"不是闰年!");
}
}else{
window.alert("请输入正确年份!");
}
}
</script>
</head>
<body>
<form action="#" name="myForm" method="post">
<p>请输入要判断闰年的年份:<p/>
<input name="theYear" type="text">
<input name="select" type="button" value="计算" onClick="isLeapYear()">
</form>
</body>
</html>
您可能感兴趣的文章:
php判断闰年的三种方法(闰年计算方法)
php判断闰年(闰年计算方法)
php判断是否为闰年
JavaScript判断是否闰年 闰年计算方法
PHP怎么判断一年是否为闰年?
php判断平年还是闰年
js判断闰年(闰年计算方法)
Js判断闰年与闰年计算方法示例
js判断某年某月有多少天(闰年计算方法)
calendar如何判断python3时间?