php - javascript to change style display -
i have bunch of items setup <div id="first" class="source"> i'm in google chrome, , when page loads hides items when click onclick button un hide them, i'm not able click again , make hide. html <body onload="setup();"> <a href="#first" onclick="shoh('first');" > js: function setup() { foo = document.getelementbyid('first'); foo = document.getelementsbyclassname('source'); (c=0; c<foo.length; c++) { foo[c].style.display='none' } } function shoh(id) { if (document.getelementbyid(id).style.display = 'none'){ var divs = document.getelementbyid(id); for(var i=0; i<divs.length; i++) { divs[i].style.display='block' } } else { cow = document.getelementbyid(id); for(a=0; a<cow.length; a++) { cow[a].style.display='none' } } } you have couple of issue here: if compare 2 varia...