<meta http-equiv= "Content-type" content= "text/html;charset=gb2312" >
<title> Judging leap year _www.jbxue.com</title>
<script type= "Text/javascript" languge= "JavaScript" >
Can be divisible by 4 and not divisible by 100.
Or
Can be divisible by 100 and divisible by 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+ "is a leap year!) ");
}else{
Window.alert (pyear+ "is not a leap year! ");
}
}else{
Window.alert ("Please enter the correct year!") ");
}
}
</script>
<body>
<form action= "#" Name= "MyForm" method= "POST" >
<p> enter the year for which you want to judge leap years:<p/>
<input name= "theyear" type= "text" >
<input name= "Select" type= "button" value= "calculation" onclick= "Isleapyear ()" >
</form>
</body>
This article original link: http://www.jbxue.com/article/js/19568.html
JavaScript to judge leap years