|
Date: 8/19/2008 3:02 pm · Subject: Re: Help with show hide JS · Rating: 0
rogier, thanks for the reply.
i have a better one for you, the script was working perfectly. it was complaining because there was no such ID declared in the HTML of that particular article i used to test with. Bleh bleh... what a brain fart.
Despite the mishap, what I ended up doing was adding a conditional
if ( document.getElementById(id) ) { //run my script }
and this did wonders because I was able to use one template style throughout this particular section of the website.
To give a little background: the script (in it's entirety - not shown here) shows and hides Endnotes. So we have articles, and if someone wants to see the endnotes (both the little numbers within the article, and the actual endnotes at the end of the article) they click 'Show Endnotes' and wallah! Not all documents have endnotes, so the conditional above helps a lot in avoiding error alerts since there's no <div id="#endnote">list of endnotes</div> in some articles.
The script also toggles 'Show Endnotes' to 'Hide Endnotes' when clicked and vice versa; it also shows (or hides) 'Show Endnotes' if <div id="#endnotes"> exists (or not). They work well as a team.
Just in case anyone has need for it... lemme know.
--- (Edited on 8/19/2008 3:02 pm [GMT-0500] by sandraqu) ---
--- (Edited on 8/19/2008 3:03 pm [GMT-0500] by sandraqu) ---
|