theKiwi Posted February 4, 2008 Report Share Posted February 4, 2008 I'm trying to implement a simple "toggle" similar to what is in a number of places in TNG, particularly the Admin area, to show/hide a couple of blocks on the click of a button or link.I've got it working for the most part as can be seen herehttp://genealogy.clanmoffat.org/toggletest.htmlbut what I'm stumped on trying to figure out is how to change the small + icon to a - icon when the code is expanded.So can someone cleverer than me please take a look at the code on that page and tell me how I might change it so that the + becomes a - when the bulleted list is opened?The code of the JavaScript doing this is herefunction togglecm( targetId ){target = document.getElementById( targetId );if( target.style.display == 'none' ) {target.style.display = "block";}else {target.style.display = "none";}return false;}ThanksRoger Quote Link to comment Share on other sites More sharing options...
Scotty Posted February 4, 2008 Report Share Posted February 4, 2008 I'm trying to implement a simple "toggle" similar to what is in a number of places in TNG, particularly the Admin area, to show/hide a couple of blocks on the click of a button or link.I've got it working for the most part as can be seen herehttp://genealogy.clanmoffat.org/toggletest.htmlbut what I'm stumped on trying to figure out is how to change the small + icon to a - icon when the code is expanded.So can someone cleverer than me please take a look at the code on that page and tell me how I might change it so that the + becomes a - when the bulleted list is opened?The code of the JavaScript doing this is herefunction togglecm( targetId ){target = document.getElementById( targetId );if( target.style.display == 'none' ) {target.style.display = "block";}else {target.style.display = "none";}return false;}ThanksRogerRoger,Did you take a look at editconfig.php in the admin folder? The code is there that does the "swap" on the admin page.I make no claim to understand it..... Scotty Quote Link to comment Share on other sites More sharing options...
theKiwi Posted February 4, 2008 Author Report Share Posted February 4, 2008 Thanks Scotty.I'd looked at the similar thing on some other pages' code, but hadn't quite got my head around it. But another hour this morning and I've got it figured, including hiding the word "more" when the extra text is expanded.http://genealogy.clanmoffat.org/toggletest.htmlCheersRoger Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.