JavaScript display time

Want to write a time display using JavaScript, the page is not displayed, blank, turn, my source is as follows, for the master pointing.

<!DOCTYPE html>
<html>
<head>
<title>showtime.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<span>
<script language="JavaScript">
startclock();
var timerID = null;
var timerRunning = false;
function showtime(){
var Today = new Date();
var NowHour = Today.getHours(); //HH
var NowMinute = Today.getMinutes(); //MM
var NowSecond = Today.getSeconds(); //SS
var NowMonth = Today.getMonth() + 1; //MMM
var NowDate = Today.getDate(); //dd
var NowYear = Today.getYear(); //yyyy
if (NowHour <= 9)
NowHour = "0" + NowHour;
if (NowMinute <= 9)
NowMinute = "0" + NowMinute;
if (NowSecond <= 9)
NowSecond = "0" + NowSecond;

var disTime = NowYear + ""+ NowMonth +" "+ NowDate +" day month&nbsp;&nbsp;" + NowHour + ": " + NowMinute + ": " + NowSecond + "&nbsp;&nbsp;";
document.write(disTime);
if (NowDate == 1) {
disTime = disTime + "Monday";
}
if (NowDate == 2) {
disTime = disTime + "Tuesday";
}
if (NowDate == 3) {
disTime = disTime + "Wednesday";
}
if (NowDate == 4) {
disTime = disTime + "Thursday";
}
if (NowDate == 5) {
disTime = disTime + "Friday";
}
if (NowDate == 6) {
disTime = disTime + "Saturday";
}
if (NowDate == 0) {
disTime = disTime + "Sunday";
}
document.write(disTime);
timerID = setTimeout("showtime()", 1000);
timerRunning = true;
}

function stopclock(){
if (timerRunning)
clearTimeout(timerID);
timerRunning = false;
}

function startclock(){
stopclock();
showtime();
}
</script>
</span>
</body>
</html>

Open the page blank!!! Seek help!!!

Started by Bart at December 07, 2016 - 11:18 AM

document.write()Generally used only before the page finishes loading.
When the page is loaded, do not use document.write ().
Then document.write () is to create a new page.
You should use.InnerHTML or.InnerText.

Posted by Ernest at December 10, 2016 - 12:08 PM