Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   Calculate and Display Time on Website (http://www.go4expert.com/forums/calculate-display-time-website-t16665/)

meerkat 25Mar2009 22:51

Calculate and Display Time on Website

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 31Mar2009 07:15

Re: Calculate and Display Time on Website
Try to Store them in Cookie with some Ajax Call

All times are GMT +5.5. The time now is 19:39.