JSP页面中使用JavaScript获取系统时间,如下代码:
- <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
- <%
- String path = request.getContextPath();
- String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
- %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <base href="<%=basePath%>">
- <title>SysTime - www.cxybl.com</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">
- <script language="JavaScript" type="text/javascript">
- function showTime(){
- var now=new Date;
- document.getElementById("dd").innerHTML=now.getFullYear()
- +"年"+(now.getMonth()+1)
- +"月"+now.getDate()
- +"日"+now.getHours()
- +":"+now.getMinutes()+":"+now.getSeconds();
- setTimeout("showTime()","1000");
- }
- </script>
- </head>
- <body onload="showTime()">
- <div id=dd></div>
- </body>
- </html>
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索javascript
, 时间
, getelementbyid
, getFullYear
, Now
getMinutes
jsp页面显示系统时间、jsp中显示系统时间、jsp获取系统当前时间、jsp获取系统时间、jsp系统时间,以便于您获取更多的相关知识。
时间: 2024-11-03 19:54:10