function switchStyle(){ // return array of all DIV elements var divs = document.getElementsByTagName("DIV"); // Iterate through all DIVs in array for(var i = 0; i < divs.length; i++){ // If current DIV is using "textDefault" styling, // change it to use "textAlternate" styling if(divs[i].className == "textDefault") divs[i].className = "textAlternate"; // If current DIV is using "textAlternate" styling, // change it back to use "textDefault" styling else if(divs[i].className == "textAlternate") divs[i].className = "textDefault"; } }