Hi i have a toggle script and i would like to have more than 1 on a page so maybe by id etc this is the script im useing below:- js:- if (document.getElementById && document.getElementsByTagName){ document.write("<link href=\"css/toggle.css\" type=\"text/css\" rel=\"stylesheet\" />") } function TJK_doToggleDL(x){ var zDD=document.getElementById('admin_toggle').getElementsByTagName('dd'); var zDT=document.getElementById('admin_toggle').getElementsByTagName('dt'); zDD[x].className=(zDD[x].className=='hideDD')?'showDD':'hideDD'; zDT[x].className=(zDT[x].className=='DTplus')?'DTminus':'DTplus'; } function TJK_ToggleDLopen(){//we open all of them var zDD=document.getElementById('admin_toggle').getElementsByTagName('dd'); var zDT=document.getElementById('admin_toggle').getElementsByTagName('dt'); for(var i=0;i<zDT.length;i++){ zDD[i].className='showDD'; zDT[i].className='DTminus'; } return false; } function TJK_ToggleDLclose(){//we close all of them var zDD=document.getElementById('admin_toggle').getElementsByTagName('dd'); var zDT=document.getElementById('admin_toggle').getElementsByTagName('dt'); for(var i=0;i<zDT.length;i++){ zDD[i].className='hideDD'; zDT[i].className='DTplus'; } return false; } function TJK_ToggleDL(){ if (document.getElementById && document.getElementsByTagName){ var zDT=document.getElementById('admin_toggle').getElementsByTagName('dt'); var zDD=document.getElementById('admin_toggle').getElementsByTagName('dd'); var ToggleON = document.getElementById('TJK_ToggleON'); var ToggleOFF = document.getElementById('TJK_ToggleOFF'); if (ToggleON && ToggleOFF){ ToggleON.onclick = TJK_ToggleDLopen; ToggleON.title = "Show all answers"; ToggleON.href = "#"; ToggleOFF.onclick = TJK_ToggleDLclose; ToggleOFF.title = "Hide all answers"; ToggleOFF.href = "#"; } for(var i=0;i<zDT.length;i++){ var zContent = zDT[i].innerHTML; var zHref = "<a href='#' onclick=\"TJK_doToggleDL("+i+");return false\" title='Show/hide the answer'>"; zDT[i].innerHTML = zHref + zContent + "</a>"; zDD[i].className='hideDD'; zDT[i].className='DTplus'; } } } Code (markup): css:- /* "Show All" + "Hide All" links */ #TJK_ToggleON, #TJK_ToggleOFF {border:1px solid #333;padding:0 5px;margin-right:5px} /* zeroing out padding and margin */ #admin_toggle dd, #admin_toggle dt {margin:0;padding:0} /* margin for the DTs (shorthand) */ #admin_toggle dt {margin:7px 0} /* image and left padding for DDs */ #admin_toggle dd {background:url('answer.gif') no-repeat;padding-left:0px} /* styling all anchors in the DTs */ #admin_toggle dt a {background:0 50% no-repeat;padding-left:32px;color:#000;text-decoration:none} #admin_toggle dt a:visited {color:#666} #admin_toggle dt a:visited:hover, #admin_toggle dt a:hover, #admin_toggle dt a:active, #admin_toggle dt a:focus {font-weight:bold} /* the + and - gif in the anchors */ #admin_toggle .DTplus a {background-image:url('adminmenuplus.gif')} #admin_toggle .DTminus a {background-image:url('adminmenuminus.gif')} /**********************************/ /**********************************/ #admin_toggle .showDD {position:relative;top:0} #admin_toggle dd, .hideDD{top:-9999px;position:absolute} #TJK_ToggleON, #TJK_ToggleOFF {display:inline;cursor:pointer; cursor:hand} /*\*//*/ #admin_toggle .showDD {display:block} #admin_toggle dd,.hideDD {top:0;position:relative;display:none} /**/ Code (markup): the other code:- <dl id="admin_toggle"> <dt class="DTplus"> <a href="#" onclick="TJK_doToggleDL(0);return false" title="Show/hide the answer"> Question 1?</a></dt> <dd class="hideDD">The vitality of conceptual synergies is of supreme importance exploiting the productive lifecycle working through a top-down, bottom-up approach. To focus on improvement, not cost, from binary cause and effect to complex patterns, while those at the coal face don't have sufficient view of the overall goals.</dd> </dl> HTML: But i bet there is a lot better script out there that i could use but just cant find 1. Thanks in advanced.
Fixed it just having problems showing it in I.E now Do any of you know were i can get a toggle script that uses + & - images jst like this 1 but abit easyer to use more than once on a page.