Solved my own problem. If you want the code just ask. meerkat
> -----Original Message----- > From: [email protected] [mailto:[email protected]] > On Behalf Of meerkat > Sent: Tuesday, February 17, 2009 9:02 PM > To: Gears Users > Subject: [gears-users] Time Online > > > Hello, > Using the code below (from the Gears website) how do I display on the > page the length of time the user has been online? For example: "You > have been online for 5 minutes, 23 Seconds". > > <script language="JavaScript" type="text/javascript"> > var numPings = 0; > var request = google.gears.factory.create('beta.httprequest'); > var TIME_BETWEEN_PINGS = 1*1000; > var PING_TIMEOUT_SECONDS = 1*1000; > > function pingSuccess() > { > if(request.responseText != "" && request.responseText.indexOf("404 > Page not found") == -1) > { > > sync(); > document.getElementById('serverStatus').innerHTML = '<img > src="http://localhost/images/online.png">'; > > > } > else > { > document.getElementById('serverStatus').innerHTML = '<img > src="http://localhost/images/offline.png">'; > } > } > > function isServerAvailable() > { > var resource_to_test = "FAQs_to_write.txt"; > resource_to_test += "?q=" + Math.floor(Math.random() * 100000); > request.open('GET', resource_to_test); > window.setTimeout("pingSuccess()",PING_TIMEOUT_SECONDS); > request.onreadystatechange = function() > { > if (request.readyState == 4) > { > > numPings++; > document.getElementById('pings').innerHTML = "Number of pings: > " + numPings; > > } > }; > > request.send(); > window.setTimeout("isServerAvailable()",TIME_BETWEEN_PINGS); > } > isServerAvailable(); > </script> > > Thanks.
