View Full Version : Regarding "Tab Content Script"

07-26-2005, 01:02 AM
I was using the "Tab Content Script" found on DD site. This is the address http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm
I noticed that the links on the tabs don't go anywhere. When clicking, all they do is change the contend of the window below the tabs. My question is, how do I make the link active? Other than that, it's a great script.

07-26-2005, 04:05 AM
That's by design, as the tab content are revealed by clicking on each tab. If the tabs also went to a URL, the tab content would never be shown as the user is taken to another page.

07-26-2005, 06:29 AM
Well, ddadmin, of course is correct but, if you want to modify it to say, reveal the content onmouseover, there is no reason not to allow the links to be active, and they will be if you just change 'onClick=' to 'onmouseover='. Also, if viewed by a non javascript enabled browser, the links will be active.

07-26-2005, 07:00 AM
Thank you all for you help and info. My question is, can I have both so that when I click the tab, it changes the tab content and the page, which will then be on the current tab. In other words, I will make a new page for each tab and when clicked on the tab, the tab content would change, along with the page. Is this possible? Any recommendations?

Thanks Again

07-26-2005, 07:20 AM
Use the optional persistence code. For what you are talking about, set it to sitewide and also remove 'return' from the onClick events, changing (from the demo):

<a href="new.htm" onClick="return expandcontent('sc2', this)" theme="#EAEAFF">What's New</a>to this:

<a href="new.htm" onClick="expandcontent('sc2', this)" theme="#EAEAFF">What's New</a>

07-26-2005, 07:36 AM
Thanks John. What you recommended worked. The only thing now is that after the first time I use the tab, the next time I click on it, it won't change the page. Its as if it only allows itself to be used once. After the initial use of the tab, the page remains the same, but the tab content continues to work properly. What do you suppose I do know?
Thanks again.

07-26-2005, 08:46 AM
Did you remember to remove "return" from the onClick code across all pages that use this script?

07-26-2005, 05:00 PM
That did the trick! Thank you! I just discovered this site and its awesome.