< 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 >