| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2729 人关注过本帖
标题:写一程序判断2008是否是闰年。
只看楼主 加入收藏
xiaoyuechuan
Rank: 2
等 级:论坛游民
帖 子:15
专家分:25
注 册:2010-4-6
收藏
得分:0 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>判断闰年</title>
</head>

<body><form action="" method="get" name="form1" id="form1">
  请输入年份:
  <label>
  <input name="nian" type="text" id="nian" size="4" maxlength="4" />
  </label>
  <label>
  <input type="button" name="Submit" value="是否闰年"  onclick="aaa()" />
  </label>
</form>

<script type="text/javascript">
//闰年:能被4整除不能被100整除;能被100整除也能被400整除.
function   aaa(){
      var  a=document.form1.nian.value;
      if(((a%4==0)&&(a%100!=0))||((a%100==0)&&(a%400==0)))
      {
      alert(a+"年是闰年");
      }
      else
      {
      alert(a+"年不是闰年")
      }

}
</script>
</body>
</html>
2010-04-23 03:53
快速回复:写一程序判断2008是否是闰年。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014013 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved