标签:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>判断闰年_www.jbxue.com</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>
本文原始链接:http://www.jbxue.com/article/js/19568.html
标签:
原文地址:http://www.cnblogs.com/love1226/p/4352045.html