静态显示:
<html><body><center> Now time is: <%=new java.util.Date()%> </center></body></html>
动态显示:
<html><head><title></title> <script type=text/javascript> var myVar=setInterval(function () {myTimer()}, 1000); var counter = 0; function myTimer() { var date = new Date(); document.getElementById(demo).innerHTML = date.toLocaleString(); } </script></head><body><center> <span id=demo></span> </center></body></html>