Old 14-03-2005, 06:57   #1 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
DOM - Show/Hide Content

Hi all,

Have used the code from Zeldman, and it shows content on a toggle kind of system.

Well thats good, but I am creating a help system for my application and I want to have help topics in the left panel, and when I click on a topic it shows the information in the right panel.

With me so far?

What I want is it to toggle any content that is not needed to display none, when a different topic is clicked.

Is this possible?
  Reply With Quote
Old 14-03-2005, 07:17   #2 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,537
Yes, it is.
  Reply With Quote
Old 14-03-2005, 07:22   #3 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
Care to offer me a solution.
  Reply With Quote
Old 14-03-2005, 07:43   #4 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,537
Do you mean do it for you? No thanks.

Try "javascript show hide" in google.
  Reply With Quote
Old 14-03-2005, 07:55   #5 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
Sorry I thought this forum was for peers to help eachother, otherwise what is its purpose, surely...
  Reply With Quote
Old 14-03-2005, 08:21   #6 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,537
Fuck me, you're lazy.

Help each other isn't the same as posting up what you want and scratching your arse while waiting for some mug to do it for you - for free.
  Reply With Quote
Old 14-03-2005, 08:36   #7 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
I haven't done nothing of the sort. I have posted a question and asked if anyone can help me, and not be abused. Don't bother replying.
  Reply With Quote
Old 14-03-2005, 08:41   #8 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,537
But I've written the script now. Oh well.
  Reply With Quote
Old 14-03-2005, 09:01   #9 (permalink)
stickmus
hmmm...
 
stickmus's Avatar
 
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,127
He's clever that NickToye, note the use of a double negative in his last comment 'I haven't done nothing'.
  Reply With Quote
Old 14-03-2005, 09:21   #10 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
Look people, if I have made a gramma error, i'm sorry, but doesn't mean you are not clever, so don't judge me.

All I did was come onto a site where I actually believe there is a good community. I never came on and said do this and I want this, and I want it now. I am learning DOM, and in particular show/hide content. I see this site as a good source of help. All I have got was a negative response and a go and find it on Google.

Well if I have been on Google but I never found exactly what I was looking for, that's why I came back to this forum.

I have never once insulted anyone, and Stickmus has just come on and made a comment that is insulting to me.
  Reply With Quote
Old 14-03-2005, 09:36   #11 (permalink)
stickmus
hmmm...
 
stickmus's Avatar
 
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,127
Haha, it was a joke, calm down dear.

Try writing a hide all function, then run that before you show the specific one.

getElementById and getElementsByTagName should be the key here. And if you're using firefox, I always find the DOM inspector ctrl+shift+i to be of great help when developing javascript stuff.
  Reply With Quote
Old 14-03-2005, 11:02   #12 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
Not a problem Stickmus, its Monday afterall, and the diazipan is only just kicking in. Well I think I have got some code that works.

PHP Code:
function toggle(div)
 {
 if (
document.getElementById('intro') && !document.getElementById('allinfo'))
 {
 var 
option=['intro','cms','three'];
 for(var 
i=0i<option.lengthi++) 
 { 
obj=document.getElementById(option[i]);
 
obj.style.display=(option[i]==div)? "block" "none"; }
 }
 } 

It seems to work ok, I would have to add numerous options to the var, but I think I understand it.
  Reply With Quote
Old 15-03-2005, 03:20   #13 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Quote:
Originally Posted by NickToye
Look people, if I have made a gramma error

Is this in reference to Stickman? Gramma error? Freudian slip?

Sorry, I couldn't resist.
  Reply With Quote
Old 15-03-2005, 05:18   #14 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
lol
  Reply With Quote
Old 19-04-2005, 21:12   #15 (permalink)
nakedintruder
www.nakedintruder.com
 
nakedintruder's Avatar
 
Join Date: Jan 2005
Location: Leeds, Yorkshire
Posts: 383
Send a message via MSN to nakedintruder
I can't see anything 'NickToye' could have said to get laid into like that :/

Looks like he just wanted pointing in the right direction rather than it done for him, just like most other posts on a des/dev forum.
  Reply With Quote
Old 20-04-2005, 05:21   #16 (permalink)
cam
vague™
 
cam's Avatar
 
Join Date: Mar 2004
Location: Glasgow
Posts: 5,549
you cock.
__________________
  Reply With Quote
Old 20-04-2005, 09:30   #17 (permalink)
nakedintruder
www.nakedintruder.com
 
nakedintruder's Avatar
 
Join Date: Jan 2005
Location: Leeds, Yorkshire
Posts: 383
Send a message via MSN to nakedintruder

  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8