Why can't you show the time with function showTime?


< html >
< head >
< meta charset= "utf-8" >
< title > js-01.html < / title >

< script >

var today=new Date ();
var year=today.getYear ();
var month=today.getMonth ();
var hour=today.getHours ();
var minute=today.getMinutes ();
< / script >

< / head >

< body >

< input name= "btn_left" type= "button" onClick= "showTime ();" value= "time" >
< input name= "btn_right" type= "button" value= "clear" onClick= "clearContent ();" >
< div id= "content" >

</div>

< / body >
< script type= "text/javascript" >

function showTime(){
document.getElementById("content").innerHTML="<h1>:</h1>";
document.getElementById("content").innerHTML+="<h2>"+year+""+month+""+date+"</h2>";
document.getElementById("content").innerHTML+="<h2>"+hour+""+minute+"</h2>";

}
function clearContent () {

document.getElementById("content").innerHTML="";

}


</script>

< / html >

Jan.26,2022

var year = today.getFullYear(); //
var month = today.getMonth() + 1; // 0-11
var hour = today.getHours();
var date = today.getDate(); //
var minute = today.getMinutes();

document.getElementById ("content"). InnerHTML+= "< H2 > Beijing time" + year+ "year" + month+ "month" + date+ "day < / H2 >;
replace date with today

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37b73-2c09a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37b73-2c09a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?