Hi,
I'm working on a jscript function that updates a value on my page in realtime, similar to the mail quota in gmail frontpage.
I'm a little familiar with javascript but don't know exactly how to do it. Here is the code google uses in gmail.
Code JavaScript:function updateQuota() { if (!quota) { return; } var now = (new Date()).getTime(); var i; for (i = 0; i < CP.length; i++) { if (now < CP[i][0]) { break; } } if (i == 0) { setTimeout(updateQuota, 1000); } else if (i == CP.length) { quota.innerHTML = CP[i - 1][1]; } else { var ts = CP[i - 1][0]; var bs = CP[i - 1][1]; quota.innerHTML = format(((now-ts) / (CP[i][0]-ts) * (CP[i][1]-bs)) + bs); setTimeout(updateQuota, 1000); } }
Basically, what I would need is a method for executing my php script that would update the value in my page. Maybe something like:
myclass.innerHTML=myfunction();
I presume it is to be fairly simple but I just don't know the jscript methods to handle these kind of events.




Bookmarks