Anatoly Lubarsky Logo
MSSQL, .NET, Design. Life and Music

Javascript - toggle (show/hide elements)

toggle is a function that provides show/hide elements functionality in dynamic HTML. It is very famous, has long history and is used just a lot.


function toggle(elem) 
{
    var ob = document.getElementById(elem);
    var obStyleDisplay = ob.style.display;

    if (obStyleDisplay != 'none') 
    {
        obStyleDisplay = 'none';
    }
    else 
    {
        obStyleDisplay = '';
    }
}

Related Posts:

Saturday, September 22, 2007 11:51 PM

If your feedback doesn't appear right away, please be patient as it may take a few minutes to publish.

Post a Comment

Protected by CAPTCHAEnter the code you see
Name (*)  
E-mail (*)  
Url
Remember

Comment (*)