title: Set image source and background image with javascript
body: <p>I've looked at many other posts and I think I'm using the exact syntax suggested.  However, I'm not getting the images to show up.  I have a <a href="http://jsfiddle.net/abalter/An7r5/" rel="nofollow">jsfiddle</a>.  Is it a jsfiddle issue?  It's also not working on a website I'm working on.</p>
  
  <pre><code>&lt;div id="divtest"&gt;Hello&lt;/div&gt;
  &lt;img id="imgtest" /&gt;
  &lt;img id="imgreal" src="http://www.premiumbeat.com/blog/wpcontent/uploads/2012/12/free.jpeg" /&gt;
  
  var string = "url('http://www.premiumbeat.com/blog/wpcontent/uploads/2012/12/free.jpeg')";
  alert(string)
  document.getElementByID("divtest").style.backgroundImage = string;
  document.getElementByID("imgtest").src = string;
  </code></pre>