Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Toggle text?

  1. #1
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    Toggle text?

    hello,
    I'm trying to toggle this text, but it's not working, and i can't see why.

    PHP Code:

    <div id='HeaderLink' name='HeaderLink' onclick='HideHeaders()'>View Headers</div>
    <
    script>
    function 
    HideHeaders(){
        var 
    strLink document.getElementById("HeaderLink").innerHTML;
        
    strLink= (strLink == "Hide Headers") ? "View Headers" "Hide Headers";
    }
    </script> 
    any ideas would be great!

    thanks in advance for your time!
    -Ken

  • #2
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Code:
    …
    	var strLink = document.getElementById('HeaderLink');
    	strLink.innerHTML = (strLink.innerHTML == 'Hide Headers') ? 'View Headers' : 'Hide Headers';
    …


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •