sclsch

java备忘

BlogJava 首页 新随笔 联系 聚合 管理
  10 Posts :: 0 Stories :: 6 Comments :: 0 Trackbacks

date.js:
 function writeDateInfo(){
        var day
="";
        var month
="";
        var ampm
="";
        var ampmhour
="";
        var myweekday
="";
        var year
="";
        mydate
=new Date();
        myweekday
=mydate.getDay();
        mymonth
=mydate.getMonth()+1;
        myday
= mydate.getDate();
        myyear
= mydate.getYear();
        year
=(myyear > 200? myyear : 1900 + myyear;
        
if(myweekday == 0)
        weekday
=" 星期日";
        
else if(myweekday == 1)
        weekday
=" 星期一";
        
else if(myweekday == 2)
        weekday
=" 星期二";
        
else if(myweekday == 3)
        weekday
=" 星期三";
        
else if(myweekday == 4)
        weekday
=" 星期四";
        
else if(myweekday == 5)
        weekday
=" 星期五";
        
else if(myweekday == 6)
        weekday
=" 星期六";
        document.write(year
+""+mymonth+""+myday+""+weekday);
    }
  


页面:
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript" src="${ctx}/scripts/date.js"></script>

<div id="date"><script>writeDateInfo();</script></div>
posted on 2007-09-12 22:51 sclsch 阅读(1560) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: