I have timers on my web page: each one of them with a unique id.
This is how it looks like: http://img854.images开发者_如何学Chack.us/img854/2756/changed.png
They start on body load, js function is called which then loops every 1 second, gets XML with ajax and updates the timers based on what it gets from the DB in xml (end_time).
What's bothering me is that, when I change the timer's id with firebug, the timer stops. Whereas, when I do that on this site: http://www.phppennyauctiondemo.com/ the timers never stop, no matter what I change.
So my question is: how are they doing that?
On page load they are creating and storing objects that represent each auction item in the DOM. Their updates act on those objects and don't try to look up each DOM element every time.
Take a look at default.js in their source.
精彩评论