來練習 JS 如何處理時間的吧!
<h1 class="time"></h1>
<button class="transTime">現在是民國幾年</button>
var ele = document.getElementsByClassName("time")[0]
var trans = document.getElementsByClassName("transTime")[0]
var now = new Date().getFullYear()
ele.innerHTML = now
trans.addEventListener('click', function(){
now = now - 1911;
ele.innerHTML = '民國 ' + now
trans.disabled = 'disabled'
})