No offence, but the current one only takes ids and doesn't allow multiple hide/shows! So how about we have something like: function hide(x){ for(n in x) x[n].style.display = (x[n].style.display == '')? 'none' : ''; }