Forum Moderators: open

Message Too Old, No Replies

Show/Hide Div

         

somekindofinsane

9:49 pm on Dec 6, 2007 (gmt 0)

10+ Year Member



I've been a longtime visitor to the site and I've learned a lot from all of the talented folks willing to share their knowledge here with beginners like myself.

I'm new to Javascript, but have some basic knowledge. I am running into an issue I can't seem to get past and was hoping someone could point me in the right direction.

I did a couple searches but I couldn't find anything that would meet my needs.

I need something simple, I just don't know how to do it. I want to make a div containing three "tabs" and three individual divs, one for each tab. When you click on tab one, the tab one div shows, when you click on tab two, tab two div shows and tab one div hides, etc.

Just a show/hide deal, seems easy enough, BUT my issue is that I am developing this piece in a proprietary platform that does not allow Javascript inline. It strips it out automatically, there is no way to include it in the page itself.

What I need is to contain all necessary Javascript in an external .js that I can call, that somehow identifies the div ids in my XHTML and performs the necessary actions.

I've honestly searched for hours and all solutions I can find require some piece, however small, of Javascript in the page/XHTML itself. That just isn't a possibility, so I'm hoping someone can help me find another solution.

Thanks in advance, I appreciate the opportunity to post here. I'm looking forward to becoming more involved wherever I can on these forums. :)

Fotiman

10:09 pm on Dec 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have you thought about using one of the existing JavaScript Libraries for this, like the Yahoo UI Library [developer.yahoo.com]'s TabView [developer.yahoo.com] component?

somekindofinsane

1:49 am on Dec 7, 2007 (gmt 0)

10+ Year Member



Wow, that library looks like an amazing resource. I honestly had never heard of it before, and oddly enough I don't recall coming across it in my searches.

It should go to show you how new I am to Javascript that I haven't heard of it, but it does look like it solves my problem very nicely.

I'm going to give it a try tomorrow first thing. Thank you very much for your assistance, I was feeling a bit lost. This solution looks like it should be easy enough for even a newbie like me to put into action. :)

Thanks again, much appreciated.