当前位置:开发者网络 >> 网页特效 >> 日期时间 >> 内容
精彩推荐
分类最新特效
分类热点特效
  
这个脚本只会显示年份和季节
日期:2004-05-24   人气:   【字体: 】【收藏此文


<!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! -->
<!-- 要实现此效果需要 1 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var now = new Date();
var month = now.getMonth() + 1;
var date = now.getDate();
var year = now.getYear();
var season;
if (month > 1 && month <= 3) season = "冬季";
if (month == 3 && date > 19) season = "春季";
if (month > 3 && month <= 6) season = "春季";
if (month == 6 && date > 20) season = "夏季";
if (month > 6 && month <= 9) season = "夏季";
if (month == 9 && date > 21) season = "秋季";
if (month > 9 && month <= 12) season = "秋季";
if (month == 12 && date > 20) season = "冬季";
//Y2K Fix
if (year < 2000) year = year + 1900;
//Winter Season Fix
if (season == "Winter") year = year - 1;
document.write(year + "年 " + season);
// End -->
</script>