javascript Loop through array
function HideDiv(CatID) { CatID = parseInt(CatID); var Categories = new Array(1, 2, 3, 123); var Hide = false; //loop through Categories, if matches - hide the div for (var i in Categories) { if (Categories[i] == CatID) { Hide = true; } } if (Hide == true) { document.getElementById("divID").style.display = "none"; } else { document.getElementById("divID").style.display = "block"; } }
Example of looping through an array, to see if CatID matches.
Updated: Thursday 7th October 2010, 10:59pm
There are 0 comments
Comments are currently closed.