title: Let address link open hide section in JavaScript
body: <p>I am new in JS so my question is it possible if I have many sections and I can open them when click on button (they are <code>display: none;</code> by default and opens when click on menu button on same page). I need to create links that if someone enters in address box then that sections opens... but how to make that if its <code>display: none;</code> by address? Maybe i am wrong and you can suggest some better method ?</p>
  <pre><code>&lt;section style=&quot;display: none;&quot; id=&quot;sectionIepirkumi&quot; class=&quot;w3-container w3-threequarter section&quot;&gt;
    &lt;div id=&quot;sectionTopLine&quot; class=&quot;w3-border-top w3-border-green&quot;&gt;&lt;/div&gt;
    &lt;h5 id=&quot;sectionAddress&quot; class=&quot;w3-margin-bottom&quot;&gt;
      &lt;a id=&quot;sectionAddressFirstPageLink&quot; class=&quot;sectionAddressLink&quot; onclick=&quot;openSection('sectionFirstPage')&quot;&gt;
            Sākumlapa &lt;/a&gt;/
      &lt;a class=&quot;sectionAddressLink&quot; onclick=&quot;openSection('sectionAboutSchoolPage')&quot;&gt; Par Skolu &lt;/a&gt;/
      &lt;a class=&quot;&quot; style=&quot;font-weight: bold;&quot;&gt; IEPIRKUMI&lt;/a&gt;
    &lt;/h5&gt;
    &lt;div id=&quot;sectionBottomLine&quot; class=&quot;w3-border-top w3-border-green w3-margin-bottom&quot;&gt;&lt;/div&gt;
    &lt;div class=&quot;w3-panel w3-border&quot;&gt;
      &lt;h3&gt;Uz doto momentu nav aktuālu iepirkumu!&lt;/h3&gt;
    &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  <pre><code>function myFunction(id) {
    var x = document.getElementById(id);
    if (x.className.indexOf(&quot;w3-show&quot;) == -1) {
      x.className += &quot; w3-show&quot;;
    } else {
      x.className = x.className.replace(&quot; w3-show&quot;, &quot;&quot;);
    }
  }
  </code></pre>