<script no-pjax=""> //頁面每次跳轉都會執行window.pjaxLoaded = function(){}內的程式碼 window.pjaxLoaded = function(){ let blog_running_days=document.getElementById("blog_running_days"); let blog_running_hours=document.getElementById("blog_running_hours"); let blog_running_mins=document.getElementById("blog_running_mins"); let blog_running_secs=document.getElementById("blog_running_secs"); functionrefresh_blog_running_time(){ let time = newDate() - newDate(2021, 7, 25, 0, 0, 0); let d=parseInt(time/24/60/60/1000); let h=parseInt(time%(24*60*60*1000)/60/60/1000); let m=parseInt(time%(60*60*1000)/60/1000); let s=parseInt(time%(60*1000)/1000); blog_running_days.innerHTML=d; blog_running_hours.innerHTML=h; blog_running_mins.innerHTML=m; blog_running_secs.innerHTML=s; }; refresh_blog_running_time(); if (typeof(bottomTimeIntervalHasSet) == "undefined"){ let bottomTimeIntervalHasSet = true; setInterval(function(){refresh_blog_running_time();},500); }; }; window.pjaxLoaded(); //手動執行 window.pjaxLoaded 讓網頁在第一次載入時也會執行這段腳本 </script>