Blogger Information
Blog 17
fans 1
comment 1
visits 16490
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
判断是平年还是闰年
雷国恩的博客
Original
1276 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>	</title>
  <style type="text/css">
  	.box{width:310px;height:150px;border:1px solid red;margin:100px auto;padding:10px;}
  	h2{width:250px;height:20px;display: block;line-height: 20px;margin:0 auto;text-align:center;}
  </style>

  <script type="text/javascript">
     var number,text,jieguo;
  	 window.onload=function(){
  	 	text=document.getElementById('text');

  	 	jieguo=document.getElementById('jieguo');

  	 	}

  	 	function jisuan(){
  	 		var a=Number(text.value);
  	 		if(typeof(a)=="number"){
  	 			if(!isNaN(a)){
  	 				if((a%4==0 && a%100!=0) || a%400==0 ){	
	  	 				jieguo.innerHTML=a+"是闰年";
	  	 			}else{
		  	 			jieguo.innerHTML=a+"是平年";
		  	 		}
  	 			}else{		
  	 				jieguo.innerHTML="你输入的不是数字,请重新输入";
  	 			}	
  	 			
  	 		}
  	 		
        	
  	 }

  </script>
</head>
<body>
	<div class="box">
		<h2>判断是平年还是闰年</h2><br>
		<span>请输入年份:</span>
		<input id="text" type="text" value=""><input type="button" onclick="jisuan();" value="判断"><br>
		<span id="jieguo"></span>
	</div>
</body>
		
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!