Go Back   Dynamic Drive Forums > DD Scripts > Dynamic Drive scripts help
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-22-2006, 07:46 PM
sitez55 sitez55 is offline
New Comer (less than 5 posts)
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default (Tutorial) Tab Content - Select All switch

1) Script Title:
Tab Content Script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...tabcontent.htm

3) Describe problem:
This is an addition

For all of you that want to show all of the content contained in the tab, but don't want to repeat it for printing purposes, make this change to your tabcontent.js script. You need to cut and paste the whole function as I rearranged things.

USAGE: put a DIV named selectall in your tabs, when selected, it will display the content of all the tabs.
Code:
function expandcontent(linkobj){
var ulid=linkobj.parentNode.parentNode.id //id of UL element
var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
for (var i=0; i<ullist.length; i++){
ullist[i].className=""  //deselect all tabs

linkobj.parentNode.className="selected"  //highlight currently clicked on tab
if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
	document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents
// HERE'S THE CHANGE - SELECTS ALL WHEN DIV="selectall" 
if (linkobj.getAttribute("rel")=="selectall") {
	document.getElementById(tabcontentIDs[ulid][i]).style.display="block" //expand corresponding tab content
}
}
linkobj.parentNode.className="selected"  //highlight currently clicked on tab
document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content
saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
}

function savetabcontentids(ulid, relattribute){// save ids of tab content divs
if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet
tabcontentIDs[ulid]=new Array()
tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute
}
Reply With Quote
  #2  
Old 07-24-2006, 11:17 PM
iwdynamic iwdynamic is offline
Junior Coders
 
Join Date: Jul 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Couldn't get this to work properly.

Only the added tab (rev = "selectall") will show content but all other tabs have javascript error:
Error: document.getElementById(tabcontentIDs[ulid][i]) has no properties
Reply With Quote
  #3  
Old 07-27-2006, 06:58 AM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 19,005
Thanks: 19
Thanked 1,135 Times in 1,121 Posts
Blog Entries: 3
Default

I couldn't get it to work either, see:

http://www.dynamicdrive.com/forums/s...3&postcount=12

where I made up my own solution for this idea.
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:08 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.