function menuprop(){ while(cats > catndx){ //while there are still categories menuhtml += "
" + catarray[catndx] + "
"; menuhtml += ""; menuhtml += "
"; menuhtml += "
"; catndx++; } //outside loops document.getElementById("sidemenu").innerHTML = menuhtml; document.getElementById("dummy").innerHTML = menuhtml; }