title: Setting img tag's src as the result of a javascript function
body: <p>I have a function getImgurUrl() and I want what it returns to be the src value of a img tag.</p>
  
  <p>How can I do this?</p>
  
  <p>my function:</p>
  
  <pre><code>function getImgurUrl() {
      //get imgur url for current image
      var cookieArray = document.cookie.split(";");
      var encodedURL = cookieArray[2].split("=");
      var decodedURL = decodeURIComponent(encodedURL[1]);
      return decodedURL;
  }
  </code></pre>
  
  <p>and img tag:</p>
  
  <pre><code>&lt;img id="image" name="image" src=""  alt="If you're seeing this something is wrong."&gt;
  </code></pre>