1. Display the current time in the Web page in real time<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> Show System time on page </title>
<body onload= "ShowTime ()" >
Current time: <span id= "Show" ></span>
</body>
<script>
function ShowTime () {
var nowtime = new Date ();
var years = Nowtime.getfullyear ();
var mouths = Nowtime.getmonth ();
var days = Nowtime.getdate ();
var hours = nowtime.gethours ();
var minites = Nowtime.getminutes ();
var seconds = nowtime.getseconds ();
var time = years+ "year";
Time + = (mouths+1) + "month" +days+ "Day";
Time + = (hours<10? ") 0 ":") +hours;
Time + = (minites<10? ": 0": ":") + minites;
Time + = (seconds<10? ": 0": ":") + seconds;
Time + = (hours>12)? " PM ":" AM ";
document.getElementById ("show"). InnerHTML = time;
setTimeout ("ShowTime ()", +);
}
</script>
2, achieve the effect:
JS Display dynamic system time--javascript base