title: Calling javascript functions from drop down
body: <p>I have this HTML code at the moment:</p>
  
  <pre><code>Theme
  &lt;ul id="dropdown"&gt;
      &lt;li&gt; Choose theme
          &lt;ul&gt; 
              &lt;li id="stylesheet1" &gt; &lt;a href="#"&gt; Default &lt;/a&gt;&lt;/li&gt;
              &lt;li id="stylesheet2" &gt; &lt;a href="#"&gt; Theme 1 &lt;/a&gt;&lt;/li&gt;
              &lt;li id="stylesheet3" &gt; &lt;a href="#"&gt; Theme 2 &lt;/a&gt;&lt;/li&gt;
              &lt;li id="stylesheet4" &gt; &lt;a href="#"&gt; Theme 3 &lt;/a&gt;&lt;/li&gt;
  
          &lt;/ul&gt;
      &lt;/li&gt;
  &lt;/ul&gt; 
  </code></pre>
  
  <p>And in a separate javascript document I have this code:</p>
  
  <pre><code>function initate()
  {
  
  document.getElementById("myList").onchange = function() {
     var sheet=document.getElementById("myList").value;
  
     if(sheet=="one"){
     setActiveStyleSheet("theme1");
     }
     else if(sheet=="two"){
     setActiveStyleSheet("theme2");
     }
     else if(sheet="three"){
     setActiveStyleSheet("theme3");
     }
     else{
     setActiveStyleSheet("default");
     }
     return false
  };
  
  }
  
  window.onload = initate;
  </code></pre>
  
  <p>Now this works good but instead of the dropdown I'm using above I'd like to use this HTML code instead:</p>
  
  <pre><code>Select Theme
  &lt;form&gt;
  &lt;select id="myList" &gt;
    &lt;option id="stylesheet1"&gt;Default&lt;/option&gt;
    &lt;option id="stylesheet2"&gt;Theme 1&lt;/option&gt;
    &lt;option id="stylesheet3"&gt;Theme 2&lt;/option&gt;  
    &lt;option id="stylesheet4"&gt;Theme 3&lt;/option&gt;
  &lt;/select&gt;
  &lt;form&gt;
  </code></pre>
  
  <p>As before I would like to have my event handlers in my separate javascript document. I've tried to replace my javascript into these kind of functions:</p>
  
  <pre><code>document.getElementById("stylesheet1").onchange = function() {
     setActiveStyleSheet("default");
     return false
  };
  </code></pre>
  
  <p>But it doesn't work. How do you correct call functions this way?</p>