Calculate and Display Time on Website

meerkat's Avatar, Join Date: Mar 2009
Newbie Member

I have a Javascript that calculates and displays how long, in minutes and seconds a user has been in online(Google Gears development) mode on a given web page. I need however, to modify the script so that it calculates and displays how long the user has been online on the web site. For e.g. on page 1 for 2 minutes 12 seconds. Moves to page 2 - total time on page 1 and 2= 4 minutes 13 seconds. My script (see below) starts a second counter then converts that to minutes and seconds. I have tried passing the secVar0 variable in the url but that comes back "undefined".

Does anyone have any pointers please?

if(request.responseText != "" && request.responseText.indexOf("404 Page not found") == -1)
        var startTicker = startCount1();
         secVar0 = startTicker;
        minVar = Math.floor(secVar0/60); 
        secVar = secVar0 % 60;        
        document.getElementById('Text1').innerHTML = "Time Online: " +" Minutes: " +minVar+" Seconds: "+ secVar; 
        document.getElementById('serverstatus').innerHTML = '<img src="online.gif">';  
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Try to Store them in Cookie with some Ajax Call