If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Two menus. Two buttons. Need some help

Hello, long time lurker, first time poster here. I need some help with something that's been driving me batty lately (also fairly new to the world of js):

I have two buttons and two menus that are nested inside the same div. What I would like to happen is when one button is clicked the former menu disappears and is replaced with the other menu and the other way around.

The closest example of what I'm talking about are the "About" "Share" and "Add To" buttons on youtube, but I don't really care for the slide animation.
Also I need each button to have an active state.

Whew! This is probably something stupidly easy, but I'm a js newb so I would really appreciate any and all help in this matter

Okay I tried both scripts and jmrker is closest to what I am talking about, however it neither one will work in IE 8 which is what I'm currently using. Both run fine in non-IE browsers.
What could be the problem?

Once again the script works great, but I have a couple of questions about the script in your second script posting since I'm the type who likes to know how and why a script works rather than just copying and pasting:

What is the purpose of the parameters in both the buttons and functions?

Once again the script works great, but I have a couple of questions about the script in your second script posting since I'm the type who likes to know how and why a script works rather than just copying and pasting:

What is the purpose of the parameters in both the buttons and functions?

Thanks again!

First off, you're most welcome. Happy to help.

Concerning the 2 arguments in the button function.
The 1st controls the specific <div> tag associated with the particular menu to display.
The 2nd controls the current button. Allows controls of the background-Color with the CSS style.display

Okay that makes sense to me, but why are the parameters given different names in the actual function (IDS,info) and why is 'this' used in place of 'info' in the buttons?

Did I mention I'm fairly new to javascript? Thanks!

The IDS refers to the appropriate <div id='xxx' ....> element.
The 'this' refers to the button element. 'info' is the placeholder for 'this' in the function being called.
Two different elements, hence two different parameters.

Very cool. The IDS parameter makes sense to me because it is encompassing two different ids.

I guess I was confused to why 'info' wasn't used in the button function instead of 'this', but 'this' actually refers to the button element itself, which is then represented in the actual function as 'info' and that is how javascript knows which element to make the changes to in regards to the 'info' placeholder.