title: Why can't I retrieve a return value from a function with another function?
body: <p>Why won't this work?</p>
  
  <p>Var "i" works fine, and the return value can be seen, just not when I try to send the var "i" like I have bellow.</p>
  
  <p>Button that send to deor_viewer function:</p>
  
  <pre><code>&lt;div onclick="deor_viewer('deor','films_deor_ip_full_','1','.jpg')"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>The function:</p>
  
  <pre><code>function deor_viewer(folder,name,id,ext) {
  
      var x;
      x = 'url(assets/images/films/'+ folder + '/' + name  + id + ext;
  
      document.getElementById("deor_ip_viewer_id").style.backgroundImage = x; 
  
      var i = id;
      return i;                                                                                                               
  
  };
  </code></pre>
  
  <p>An HTML button calls this function:</p>
  
  <pre><code>function viewer_right() {
      var test = deor_viewer();
      alert(test);
  }
  </code></pre>
  
  <p><code>alert</code> just comes up as "undefined"</p>
  
  <p>It will work fine, just not when the <code>return</code> is sent with the <code>var</code> </p>