View Full Version : Toggle text?

07-07-2007, 09:26 PM
I'm trying to toggle this text, but it's not working, and i can't see why.

<div id='HeaderLink' name='HeaderLink' onclick='HideHeaders()'>View Headers</div>
function HideHeaders(){
var strLink = document.getElementById("HeaderLink").innerHTML;
strLink= (strLink == "Hide Headers") ? "View Headers" : "Hide Headers";

any ideas would be great!

thanks in advance for your time!

Bill Posters
07-07-2007, 10:47 PM

var strLink = document.getElementById('HeaderLink');
strLink.innerHTML = (strLink.innerHTML == 'Hide Headers') ? 'View Headers' : 'Hide Headers';