How to show or hide text using javascript?

<head>
<script>
function showhide(id)
{
    if (document.getElementById)
    {
        obj = document.getElementById(id);
        if (obj.style.display == "none")    //check if already hidden, if yes make it appear
             obj.style.display = "";
        else
             obj.style.display = "none";    //if already appearing then hide here
    }
}
  </script>
</head>

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

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>