title: Javascript change icon
body: <p>I try to change the icon with select element. I have made it with 2 values, but now I need 3. </p>
  
  <p>Any idea what is wrong with this code?</p>
  
  <pre><code>var icon = document.getElementById.("marker-icon"); 
      if (type == 1) {  
          marker-icon.src = "images/icon1.png";
      } else if (type == 2) {
          marker-icon.src = "images/icon2.png";
      } else if (type == 3) {
          marker-icon.src = "images/icon3.png";
  }
  </code></pre>
  
  <p>This code is for 2 values and it works fine. </p>
  
  <pre><code>var icon = (type == 1) ? "images/icon1.png" : "images/icon2.png";
  </code></pre>