Gudday all
I have been looking at using JS to hide/show content. It has been harder than I thought and now I am (almostly) shameless using others ideas.
I have been making progress but have hit a road block. I am 'losing' the section title when I select the show content.
The code in the body section is
whilst the JS itself isCode:<!-- ACT stockists --> <p><a href="#" id="ACT-show" class="showLink" onclick="showHide('ACT');return false;">ACT</a></p> <div id="ACT" class="more"> For your nearest stockists please look at the NSW or Vic lists. <p><a href="#" id="ACT-hide" class="hideLink" onclick="showHide('ACT');return false;">Hide this content.</a></p> </div>
I an losing the title ACT when I click on the ACT link itself. I would like to keep it visible if possible.Code JavaScript:<script language="javascript" type="text/javascript"> function showHide(shID) { if (document.getElementById(shID)) { if (document.getElementById(shID+'-show').style.display != 'none') { document.getElementById(shID+'-show').style.display = 'none'; document.getElementById(shID).style.display = 'block'; } else { document.getElementById(shID+'-show').style.display = 'inline'; document.getElementById(shID).style.display = 'none'; } } } </script>
I am sure the answer is frightfully simple but I cannot find it.
Also I note that many sites use '+' to expand the content and '-' to hide said content. I presume that those symbols must be images. Is that correct and are they readily available or must one roll their own?



Reply With Quote





Bookmarks