Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2008
    Posts
    34
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Run javascript before page displays (but after DOM has been loaded)

    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?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,854
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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.
    Last edited by abduraooft; 04-30-2008 at 04:37 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Mar 2008
    Posts
    34
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    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.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,854
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •