马光军--------BLOG

BlogJava 联系 聚合 管理
  1 Posts :: 25 Stories :: 5 Comments :: 0 Trackbacks

显示动态时间的页面:

<%@page contentType="text/html;charset=UTF-8"%>
<%@include file="/WEB-INF/jsp/common/forward_portal.jsp"%>
<%@include file="/WEB-INF/jsp/common/meta.jsp"%>
<%@include file="/WEB-INF/jsp/common/taglibs.jsp"%>
<html>
    
<head>
        
<title>top</title>
        
<link href="css/infopush_portal.css" rel="stylesheet" type="text/css">
        
<script src="js/datagather/infopush/dateTime.js" type="text/javascript"></script>
    
</head>
    
<body>
        
<table width="100%" border="0" cellspacing="0" cellpadding="0">
            
<tr height="27">
                
<td background="images/doc/time_bg.jpg">
                    
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                        
<tr>
                            
<td width="36%" align="center">
                                登录用户:${ sessionScope.userName}
                            
</td>
                            
<td width="32%">
                                所属组织:${ sessionScope.orgName}
                            
</td>
                            
<td id="time">
                                  
<script>showTime(time)</script>
                            
</td>
                        
</tr>
                    
</table>
                
</td>
            
</tr>
            
<tr>
                
<td>
                    
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                        codebase
="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
                        width
="991" height="109">
                        
<param name="movie" value="images/infopush/infopushtop.swf">
                        
<param name="quality" value="high">
                        
<embed src="images/infopush/infopushtop.swf" quality="high"
                            pluginspage
="http://www.macromedia.com/go/getflashplayer"
                            type
="application/x-shockwave-flash" width="991" height="109"></embed>
                    
</object>
                
</td>
            
</tr>
            
<tr height="26">
                
<td bgcolor="#84b5fd">
                    
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                        
<tr>
                            
<td width="189">
                                
<img src="images/file/systemname.jpg" width="189" height="26" />
                            
</td>
                            
<td align="center"></td>
                        
</tr>
                    
</table>
                
</td>
            
</tr>
        
</table>
    
</body>
</html>

dateTime.js代码如下:
function showTime(element) {
    var date1 = new Date();
    var year1 = date1.getYear();
    var month1 = date1.getMonth() + 1;
    var day1 = date1.getDay(); 
    var daydate = date1.getDate();
    var hour1 = date1.getHours();
    var minute1 = date1.getMinutes();
    var second1 = date1.getSeconds();
    var temp;
    if (hour1 
< "10") {
        hour1 
= "0" + hour1;
    }
    if (minute1 < "10") {
        minute1 
= "0" + minute1;
    }
    if (second1 < "10") {
        second1 
= "0" + second1;
    }
    switch (day1) {
      case 0:
        temp 
= "星期日";
        break;
      case 1:
        temp 
= "星期一";
        break;
      case 2:
        temp 
= "星期二";
        break;
      case 3:
        temp 
= "星期三";
        break;
      case 4:
        temp 
= "星期四";
        break;
      case 5:
        temp 
= "星期五";
        break;
      case 6:
        temp 
= "星期六";
        break;
    }
    element.innerHTML 
= "今天是:"+year1 + "年" + month1 + "月" + daydate + "日" +" "+ temp;
    element.innerHTML 
= "今天是:"+year1 + "年" + month1 + "月" + daydate + "日" +" "+ temp + " " + hour1 + ":" + minute1 + ":" + second1;
    window.setTimeout("showTime(" + element.id + ")", 1000);
}

两个文件一整合,就能看见动态的时间。
posted on 2008-12-02 20:47 马光军 阅读(83) 评论(0)  编辑  收藏

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


网站导航: