批改状态:未批改
老师批语:
<!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>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号