<div id="load-time">Calculating page load time...</div>
<script>
var showTime = document.getElementById('load-time'),
startTime = (new Date()).getTime(); // Get the time before `window.onload`
window.onload = function() {
// Get the current time in `window.onload`
var endTime = (new Date()).getTime();
// Now use the `startTime` and `endTime` to calculate the seconds
// And show the result inside `#load-time`
showTime.innerHTML = "Page load time = " + ((endTime-startTime)/1000) + " sec(s).";
};
</script>
Tags:
JavaScript
Potongan
0 Response to "Menampilkan Total Waktu Memuat Halaman"
Post a Comment