Monday, 19 May 2014

Close all Open divs to show the clicked One in Javascript

var divState = {};
function showhide(id) {
    if (document.getElementById) {
        var divid = document.getElementById(id);
        divState[id] = (divState[id]) ? false : true;
        //close others
        for (var div in divState){
            if (divState[div] && div != id){
                document.getElementById(div).style.display = 'none';
                divState[div] = false;
            }
        }
        divid.style.display = (divid.style.display == 'block' ? 'none' : 'block');
    }
}



<a href="JavaScript:divexpandcollapse('Div_Failed_<%# Eval("SNoM") %>_<%# Eval("Failed_Cnt") %>');"><%# Eval("Failed_Cnt")%> </a>

No comments:

Post a Comment