How to show or hide text using javascript?

function showhide(id)
    if (document.getElementById)
        obj = document.getElementById(id);
        if ( == "none")    //check if already hidden, if yes make it appear
    = "";
    = "none";    //if already appearing then hide here

<div id="texthide">
Your text to dispay and hide goes here</div>
<a href="#" onclick="showhide('texthide'); return(false);">show/hide</a>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>