About This Script
Add this to your page by pasting the code (below) anywhere inside the <body> tag you would like it to appear.Code
<script>
(function(){
var timeOnPage = 0;
function incremementTimeOnPage() {
++timeOnPage;
showtimeOnPage();
}
function showtimeOnPage() {
var hours = (timeOnPage / 3600) % 24;
var minutes = (timeOnPage / 60) % 60;
var seconds = timeOnPage % 60;
var str = '';
if (hours >= 1) {
str += Math.floor(hours) + ' hour' + s(hours) + ' ';
}
if (minutes >= 1) {
str += Math.floor(minutes) + ' minute' + s(minutes) + ' ';
}
str += seconds + ' second' + s(seconds) + ' ';
document.getElementById('timeOnPage').innerHTML = "You've been on this page for " + str;
}
function s(num) {
if (num >= 2) {
return 's';
}
return '';
}
setInterval(incremementTimeOnPage, 1000);
})();
</script>
<noscript>Time on page provided by <a href="http://www.top-site-list.com">Top Site List Planet</a></noscript>
<span id="timeOnPage"></span>
More scripts