04检查是否为闰年.htm

来自「介绍了javascript的常用的函数」· HTM 代码 · 共 31 行

HTM
31
字号
<html>
<head>
<title>检查是否为闰年</title>
<script language="javascript">
<!--
	function isLeapYear(year){
		if (year % 4 == 0){
			if (year % 100 == 0){
				if(year % 400 == 0){
					str = year + "是闰年";
				}else{
					str = year + "不是闰年";
				}
			}else{
				str = year + "是闰年";
			}
		}else{
			str = year + "不是闰年";
		}
		alert(str);
	}
//-->
</script>
</head>
<body>
<form name="form1">
	<input type="text" name="year" value="2000">
	<input type="button" value="是否是闰年" onClick="isLeapYear(form1.year.value)">	
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?