PDA

View Full Version : Complete newbie!



jonybigude
06-23-2006, 09:36 AM
Hi there!

First of all, i'm a complete dumb on HTML... so, apologize me for any stupid things i say here... I'm posting this here, because i belive that it's JAVASCRIPT, so here it goes:

I did follow this tutorial:

http://www.dynamicdrive.com/dynamicindex1/navigate2.htm

So far so good. I'd manage to make it work just fine. There is only one thing about it. I would like that the last opened menu close when anotherone is opened, because you can actually open 2 items of the menu, and i only want that just one can be opened at the time.

You can see an example here:

http://www.sopormetal.pt/crgasteste/regras.html

Well, i really hope that anyone can help me out here, and by the way, sorry about my english, i'm not an expert in english too...

Thanks in advance!! ;)

djr33
06-23-2006, 09:50 AM
I think all you need to do is close all the other ones when you click on one... like this:

onClick="expandcontent('thisdiv');contractcontent('otherdiv1');contractcontent('otherdiv2');"

Just close all the other divs as you open the current one.



Just out of curiosity, what language do you speak?

jonybigude
06-23-2006, 10:09 AM
Ok, thnaks for the help, but or i'm not doing it in the correct way, or it's not working... It's funny, because this already suposed to work, see these code parts here:

var collapseprevious="no"

...

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)

What am i doing wrong? :(

P.S. - djr33, i'm portuguese, so i speak portuguese :)

Jack
06-23-2006, 11:25 AM
From what I can tell it's working on my end. If it's still not working on your end try doing what he just told you. :)

jonybigude
06-23-2006, 03:25 PM
Well... after some experiments, and some opinions from friends of mine, i made a clean up on the code, and resolve the problem by creating a function that closes colapses the contents no matter what, unless you click on them...

It worked... :) But still, thanks a lot!! :)

http://www.sopormetal.pt/crgasteste/regras.html