...

View Full Version : Run javascript before page displays (but after DOM has been loaded)



brookey86
04-30-2008, 05:30 PM
What I'm trying to accomplish is to search the page for a radio button with the label "Don't know", and if there is indeed one on the page, then make its <TR> hidden (using visibility:hidden).

I have written the function to do this with getElementsByTagName for all radio buttons and traversing the DOM to find the associated label, and it works well. However, the page loads and the "Don't know" button is displayed for about a split-second before it is hidden. I tried using a script that claims to run any JS function just after DOM has been loaded, but the "Don't know" still flashes on screen before being hidden, it just disappears faster.

Any help on how to not get this to appear at all?

abduraooft
04-30-2008, 05:34 PM
You could use some server side output buffering methods(I know it's in PHP, but don't know about others), and do the required action on buffered data and then send to client side.

brookey86
04-30-2008, 05:55 PM
You could use some server side output buffering methods(I know it's in PHP, but don't know about others), and do the required action on buffered data and then send to client side.

unfortunately I can only do javascript add-ons with this software.

abduraooft
04-30-2008, 06:09 PM
Well, apply display:none; by CSS to it's parent element (or the entire body) and set it back by javascript after the DOM search.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum