I see what you mean. OK, the tabs are numbered from 0 to however many you have, and the function ajaxpage() is what really does the switching. So, if you put this function in the head of your Ajax page, the top page, the one with the tabs on it, like so:
Code:
<script type="text/javascript" src="ajaxtabs/ajaxtabs.js">
/***********************************************
* Ajax Tabs Content script- © 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
***********************************************/
</script>
<script type="text/javascript">
function linkjax(h, a, n){
ajaxpage(h,a,document.getElementById('maintab').getElementsByTagName('li')[n].firstChild);
}
</script>
Making sure that maintab in the above is the id of the <ul> element (from the demo):
Code:
<ul id="maintab" class="shadetabs">
<li class="selected"><a href="#default" rel="ajaxcontentarea">Intro</a></li>
<li><a href="externa . . .
You can now use a link anywhere on the page or within any added tab content (the external#.htm pages in the demo) like so:
Code:
<a href="javascript:linkjax('external14.htm', 'ajaxcontentarea', 2)">Link Text</a>
The red 2 is the number of the tab you are targeting, it can be the same tab currently displaying or any tab available on the top page.
Remember the tabs are numbered starting with 0, not 1.
Bookmarks