0

Can someone please make this work with multiple classes. It currently only works with one and I dont know javascript

<!--
var toggle_visibility = (function(){
   function toggle(el){
      el.style.display = el.style.display==='none' ? 'block' : 'none';
   }
   return function(cl){
      var els = document.getElementsByClassName(cl);
      for(var i=0; i<els.length; ++i){
         toggle(els[i]);
      }
   };
})();
//-->

Also heres a copy of how I am running the script

<tr><td><a href="#" onclick="toggle_visibility('nyc');">New York</a></td>
<td><a href="#" onclick="toggle_visibility('photoshop');">Photoshop Work</td>
<td><a href="#" onclick="toggle_visibility('photography');">Photography</td></tr>
<tr><td><a href="#" onclick="toggle_visibility('art');">Art Projects</td></tr>

so i just want it to work like this

<td><a href="#" onclick="toggle_visibility('art','photoshop','photography');">New York</td>
4

1 に答える 1