jsp页面利用JS做即时时间显示

时间:2022-05-22 20:28:42

jsp页面利用JS做即时时间显示

想给系统多些点缀,顺便把知识点温习一遍,不过讲真,这些都是网上扒的!我的水平现在也就这样

<%@page import="javax.xml.crypto.Data"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.util.Date" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.STYLE1 {
font-size: 12px;
color: #FFFFFF;
}
.STYLE2 {font-size: 9px}
.STYLE3 {
color: #033d61;
font-size: 12px;
}
-->
</style>
<!-- <script type="text/javascript">
setInterval("document.getElementById('time1')").innerHTML=new Date().toL; </script> -->
<%-- <%
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date currentTime = new Date();
String time=sdf.format(currentTime).toString();
%> --%>
<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
function time() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth()+1;
var day = date.getDate();
var house = date.getHours();
var minutes = date.getMinutes();
var second = date.getSeconds();
var milsecond = date.getMilliseconds();
document.getElementById("showtime").innerHTML = year + "-" + month + "-" + day + " " + house + ":" + minutes + ":" + second ; setTimeout("time()", 100);
} </script>

</head> <body onload="time(),find()"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="70" background="../images/main_05.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="24"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="270" height="24" background="../images/main_03.gif"> </td>
<td width="505" background="../images/main_04.gif"> </td>
<td> </td>
<td width="21"><img src="../images/main_07.gif" width="21" height="24"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="38"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="270" height="38" background="../images/main_09.gif"> </td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="77%" height="25" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" height="19"><div align="center"><!-- <img src="../images/main_12.gif" width="49" height="19"> --></div></td>
<td width="50"><!-- <div align="center"><img src="../images/main_14.gif" width="48" height="19"></div> --></td>
<td width="50"><!-- <div align="center"><img src="../images/main_16.gif" width="48" height="19"></div> --></td>
<td width="50"><!-- <div align="center"><img src="../images/main_18.gif" width="48" height="19"></div> --></td> <td width="26"><div align="center"><img src="../images/main_21.gif" width="26" height="19"></div></td>
<td width="100"><div align="center"><img src="../images/main_22.gif" width="98" height="19"></div></td>
<td> </td>
</tr>
</table></td>
<td width="50"><div align="center"><span class="STYLE1" id="logout">退出
</span>
</div>
</td>
<td width="220" valign="bottom" nowrap="nowrap">
<div align="right" >
<span class="STYLE1" id="showtime">
</span>

</div>
</td>
</tr>
</table></td>
<td width="21"><img src="../images/main_11.gif" width="21" height="38"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="8" style=" line-height:8px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="270" background="../images/main_29.gif" style=" line-height:8px;"> </td>
<td width="505" background="../images/main_30.gif" style=" line-height:8px;"> </td>
<td style=" line-height:8px;"> </td>
<td width="21" style=" line-height:8px;"><img src="../images/main_31.gif" width="21" height="8"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="28" background="../images/main_36.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="177" height="28" background="../images/main_32.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" height="22"> </td>
<td width="59%" valign="bottom"><div align="center" class="STYLE1">当前用户:Admin</div></td>
<td width="21%"> </td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="65" height="28"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="23" valign="bottom"><table width="58" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="cursor:hand" onMouseOver="this.style.backgroundImage='url(../images/bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#a6d0e7'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'"> <div align="center" class="STYLE3">业务中心</div></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="3"><img src="../images/main_34.gif" width="3" height="28"></td>
<td width="63"><table width="58" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="cursor:hand" onMouseOver="this.style.backgroundImage='url(../images/bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#a6d0e7'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'"><div align="center" class="STYLE3">系统管理</div></td>
</tr>
</table></td>
<td width="3"><img src="../images/main_34.gif" width="3" height="28"></td>
<td width="63"><table width="58" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="cursor:hand" onMouseOver="this.style.backgroundImage='url(../images/bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#a6d0e7'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'"><div align="center" class="STYLE3">通讯录</div></td>
</tr>
</table></td>
<td width="3"><img src="../images/main_34.gif" width="3" height="28"></td>
<td width="63"><table width="58" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="cursor:hand" onMouseOver="this.style.backgroundImage='url(../images/bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#a6d0e7'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'"><div align="center" class="STYLE3">数据管理</div></td>
</tr>
</table></td>
<td width="3"><img src="../images/main_34.gif" width="3" height="28"></td>
<td width="63"><table width="58" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="cursor:hand" onMouseOver="this.style.backgroundImage='url(../images/bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#a6d0e7'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'"><div align="center" class="STYLE3">统计报表</div></td>
</tr>
</table></td>
<td width="3"><img src="../images/main_34.gif" width="3" height="28"></td>
<td width="63"><table width="58" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="cursor:hand" onMouseOver="this.style.backgroundImage='url(../images/bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#a6d0e7'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'"><div align="center" class="STYLE3">业务管理</div></td>
</tr>
</table></td>
<td width="3"><img src="../images/main_34.gif" width="3" height="28"></td>
<td width="63"><table width="58" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="cursor:hand" onMouseOver="this.style.backgroundImage='url(../images/bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#a6d0e7'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'"><div align="center" class="STYLE3">系统配置</div></td>
</tr>
</table></td>
<td width="3"><img src="../images/main_34.gif" width="3" height="28"></td>
<td width="63"><table width="58" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="cursor:hand" onMouseOver="this.style.backgroundImage='url(../images/bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#a6d0e7'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'"><div align="center" class="STYLE3">升级维护</div></td>
</tr>
</table></td>
<td> </td>
</tr>
</table></td>
<td width="21"><img src="../images/main_37.gif" width="21" height="28"></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>