Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-21-2012, 08:14 PM   PM User | #1
GSRevolution
New to the CF scene

 
Join Date: Sep 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
GSRevolution is an unknown quantity at this point
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!
GSRevolution is offline   Reply With Quote
Old 09-21-2012, 08:30 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
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).
xelawho is offline   Reply With Quote
Old 09-21-2012, 08:44 PM   PM User | #3
GSRevolution
New to the CF scene

 
Join Date: Sep 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
GSRevolution is an unknown quantity at this point
thank you! you just saved me a massive headache xD
GSRevolution is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:40 PM.


Advertisement
Log in to turn off these ads.