title: How do I unobtrusivify this javascript?
body: <p>I pulled this simple javascript function for showing or hiding a div from <a href="http://www.willmaster.com/blog/css/show-hide-div-layer.php" rel="nofollow noreferrer">here</a>. The function is: </p>
  
  <pre><code>function ReverseDisplay(d) {
    if(document.getElementById(d).style.display == "none"){
      document.getElementById(d).style.display = "block"; 
    }else{ 
      document.getElementById(d).style.display = "none";
    }
  }
  </code></pre>
  
  <p>This requires making a link like this: </p>
  
  <pre><code>&lt;a href="javascript:ReverseDisplay('uniquename')"&gt;
     Click to show/hide.
  &lt;/a&gt;
  </code></pre>
  
  <p>It's my understanding that having the link call javascript like that is bad practice. I'd like to make the javascript unobtrusive following <a href="https://stackoverflow.com/a/688228/2063292">https://stackoverflow.com/a/688228/2063292</a>. But, that template provides a way to make some javascript execute for any link with a specified ID (e.g. all links with id="test" will call some function). I need to have a way to allow any link to pass the name of a specific div to the function, as in the original example, but I don't know how to do it. </p>