PDA

View Full Version : Tab Content Script - open tab with a link on the same page



konstance
04-18-2006, 03:19 PM
I am using this script: http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm

I have a link inside the content of 1st tab - "view more samples" - that should open the 3rd tab called "Samples". I got it to open the third tab on that same page, but the 3rd tab doesn't get highlighted properly.

I am using this code for the link:

<a href="" onClick="return expandcontent('sc3', this)">view more samples</a>

You can see the page here:

http://www.digitaltutors.com/store/product.php?productid=19&cat=51&page=1

Does anyone have an idea how I can get the "Samples" tab to highlight?

thanks!

ddadmin
04-19-2006, 04:15 AM
Firstly, per our usage terms (http://dynamicdrive.com/notice.htm), please note that the credit notice for this script should be in your actual page source. In other words, the notice:


/***********************************************
* Tab Content script- &#169; Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

should be in between the <script> tags for this script and not inside the .js file itself.

To answer your question, one way is to do the following:

First, identify the tab that you want to jump to from within the same page, and give it an ID attribute:


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

Here I'm saying the 2nd tab in the demo is the one I want to jump to.

Then, for the jump to link, do something like this:


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

Clicking on the above link should now jump to the 2nd tab while highlighting it as well.

konstance
04-19-2006, 02:02 PM
Thank you for the reply. I apologize for not following your usage terms, I guess I never came across them. I will fix that. :)

Wildfire563
08-21-2006, 05:56 AM
Hi,

It appears to me that this hint was written for the old version of the tab content script. Could you update it to support the new version?

The page in question is where I am trying to apply it is:

http://www.flyingscool.com/Downloads.htm

I'm totally lost.

Thanks,

Thomas