title: Passing variable ClientID to JavaScript function to show/hide DIV
body: <p>I have an ASPX page with 3 HTML Buttons that all fire the same JS function along with a single parameter. The buttons pass the id of a DIV and the function shows/hides that DIV.</p>
  
  <p>I can get this to work if it is one function for each button (with hard coded value) but I can't seem to figure out how to make it so the function accepts the ClientID as a parameter.</p>
  
  <pre><code>&lt;button id="a_button" onclick="Show_Hide_Display('&lt;%=section_a.ClientID%&gt;');return false"&gt;Section A&lt;/button&gt;
  &lt;button id="b_button" onclick="Show_Hide_Display('&lt;%=section_b.ClientID%&gt;');return false"&gt;Section B&lt;/button&gt;
  &lt;button id="c_button" onclick="Show_Hide_Display('&lt;%=section_c.ClientID%&gt;');return false"&gt;Section C&lt;/button&gt;
  
  &lt;script type="text/javascript"&gt;
  
      function Show_Hide_Display(divID) {
  
          var div = document.getElementById(divID);
  
          if (div.style.display == "" || div.style.display == "block") {
              div.style.display = "none";
          }
          else {
              div.style.display = "block";
          }
  
          return false;
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I have tried severl things including the above, which results in:</p>
  
  <pre><code>TypeError: Div is null
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>This is where the DIVs that will be shown/hidden are built (in a DIV below the DIV containing the buttons, above the JavaScript).</p>
  
  <pre><code>&lt;div id="pdp_section_a_intro" class="pdp_section_a_intro" runat="server"&gt;
      &lt;h2&gt;Section A&lt;/h2&gt;
      &lt;div id="section_a" Class="pdp_section" runat="server" style="display:none;"&gt;
          &lt;asp:PlaceHolder ID="pdp_subssections_a_ph" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="pdp_section_b_intro" class="pdp_section_b_intro" runat="server"&gt;
      &lt;h2&gt;Section B&lt;/h2&gt;
      &lt;div id="section_b" Class="pdp_section" runat="server"&gt;
          &lt;asp:PlaceHolder ID="pdp_subssections_b_ph" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="pdp_section_c_intro" class="pdp_section_c_intro" runat="server"&gt;
      &lt;h2&gt;Section C&lt;/h2&gt;
      &lt;div id="section_c" Class="pdp_section" runat="server"&gt;
          &lt;asp:PlaceHolder ID="pdp_subssections_c_ph" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>