I see, so it is a vague (as far as any reasonable reader of this thread so far goes) update/interval/timeout from some other portion of your code. And, at that, sans markup. I can give you some general sorts of answers though, ones that should work, if you can incorporate any of them into your setup. If you were to have, say:
HTML Code:
<div id="contact_1">Some data/text/other tags, etc.</div>
OK, something like that, if your highlight function does something to the object:
document.getElementById('contact_1')
by dynamically adding some style (basically like):
Code:
document.getElementById('contact_1').style.backgroundColor='white';
as the code you did give seems to indicate, and your update function replaces it with a similarly structured element with the same id, most browsers will lose the dynamically added style.
If however, you added another 'layer' to the markup:
Code:
<div id="c_1_h"><div id="contact_1">Some data/text/other tags, etc.</div></div>
You could add your style to "c_1_h" and replace "contact_1". Then the style (if it is relatively simple style, as it appears to be) would be maintained. Alternatively (without adding a 'layer' in the markup), you could replace only the child/children of "contact_1", leaving the division tag alone, that would preserve its highlighting.
Another way would be to highlight the element, not by adding style to it, but by adding a class designation (className) that has the highlight styles already available to it in the stylesheet. When replacing the element, you would have to check for this class name in the old element and duplicate it for the replacement element, if found.
Bookmarks