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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help with Show/Hide divs

    Original Thread where I grabbed the code from. (User: Winters)

    Issue: With all the divs "hidden," when I initially open the page, there isn't any content. I think this code was made for a page with static content. However, I need a div (in the same position as the others) to be visible upon the page loading, then if the user clicks the other links, it functions just as it does now: Shows the div (linked to the id) and hides the others including the one that is initially visible.

    Note: I literally just started learning java. I can already see it's potential, but that by no means makes it any easier to code to begin with.

    Any help would be appreciated. I've seen this done with anchor tags, but even when I took the codes, it was just too difficult to fit it into my layout. Unfortunately, I can't show a link to the website since it's offline, but if anyone needs clarification, please let me know!

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    3,020
    Thanks
    56
    Thanked 566 Times in 563 Posts
    It's a kind of a long-winded approach, but if you are happy with it, just add this line to the end of the init function:

    Code:
    document.getElementById("j_1").style.display="block";
    (substituting "j_1" the the id of the div that you want to show).

  • #3
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you! you just saved me a massive headache xD


  •  

    Posting Permissions

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