<%@ page language="java" import="java.util.*" pageEncoding="GBK"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <% request.setCharacterEncoding("GBK"); %> <head> <script language="javascript"> function showTime() { var Timer=new Date(); var h = Timer.getHours(); var m = Timer.getMinutes(); var s = Timer.getSeconds(); var d = Timer.getDate(); var mm = Timer.getMonth(); mm++; var y = Timer.getYear(); var xinqi = Timer.getDay(); var strShow=""+y+"-"+mm+"-"+d+" "+h+":"+m+":"+s+" "+"星期"+xinqi; myspan.innerText=strShow; setTimeout("showTime()",1000); } </script> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <span id="myspan">时间内容</span> <script> showTime(); </script> </head> <body> </body> </html>
?