試著用console.log() 印出效果看看。
<script>
Today = new Date();
console.log(Today);
y=Today.getFullYear();
console.log(“年:”+y);
mh=(Today.getMonth()+1);
console.log(“月:”+mh);
d=Today.getDate();
console.log(“日:”+d);
h=Today.getHours();
console.log(“時:”+h);
m=Today.getMinutes();
console.log(“分:”+m);
s=Today.getSeconds();
console.log(“秒:”+s);
</script>
接下來使用瀏覽器開啟,並按下F12(開發者模式),點選console(控制台)即可看到效果