OK, can you provide just a little more background info:
- What action triggers the JS code?
- If the code executes as the page is opening, where is the script located? In the header, the body, or does it execute on window.onload?
If you could post a bit more source code, or at least a workable sample code, that would be helpful....