title: How can I send a different ID as a parameter for a JS function?
body: <p>I'm trying to send an id to a function but I don't know how to do it. I have a my function like this</p>
  
  <pre><code>    function showHide(item) {
          if (document.getElementById('item.id').style.display=='none') {
              document.getElementBydId('item.id').style.display = '';
          }
          else {
              document.getElementById('item.id').style.display = 'none';
          }
      }
  </code></pre>
  
  <p>and my HTML like this</p>
  
  <pre><code>    &lt;div onclick="showHide(one);"&gt;
          &lt;img src="images/1.png"&gt;
      &lt;/div&gt;
      &lt;div id="one" style="display:none"&gt;
          &lt;h1&gt;X List&lt;/h1&gt;
          &lt;ul&gt;
              &lt;li&gt;Elmt 1&lt;/li&gt;
              &lt;li&gt;Elmt 2&lt;/li&gt;
              &lt;li&gt;Elmt 3&lt;/li&gt;
              &lt;li&gt;Elmt 4&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>But, I have more divs with diferent id's, so I don't want to create more functions for each id. How can I send the "one, two, three,..." id to another onclick div? </p>