This article introduces JS local refresh page time concrete implementation, need friends can refer to the
copy code code as follows:
<head>
<title></title>
<script type= "Text/javascript" >
function GetTime () {
var time = new Date ();
var year = Time.getfullyear ();
var month = Time.getmonth () + 1; Month starts from 0
var day = Time.getdate (); Note that the GETDATE ()
var hour = time.gethours ();
var minute = time.getminutes ();
var sec = Time.getseconds ();
var timestring;
if (minute < 10) {
timestring
= year + "-" + month + "-" + Day + "" + Hour + ": 0" + minute + ":" + sec;
}
else {
timestring
= year + "-" + month + "-" + Day + "" + Hour + ":" + Minute + ":" + sec;
}
//div has no value attribute
document.getelementbyidx_x ("Timediv"). InnerHTML = timestring;
Window.setinterval ("GetTime ()", 1000);
}
</script>
</head>
<body onload= "GetTime ()" >
<div id= "Timediv" >
</div>
</body>