title: Get script path
body: <p>In CSS, any image path is relative to the CSS file location.</p>
  
  <p>f.ex if I put the CSS file in <code>/media/css/mystyles.css</code> and use something like</p>
  
  <pre><code>.background:url(../images/myimage.jpg);
  </code></pre>
  
  <p>The browser will look for the image in <code>/media/images/myimage.jpg</code> which makes sense.</p>
  
  <p><strong>Is it possible to do the same thing in javascript?</strong></p>
  
  <p>F.ex if I include <code>/media/js/myscript.js</code> and put this code in there:</p>
  
  <pre><code>var img = new Image();
  img.src = '../images/myimage.jpg';
  </code></pre>
  
  <p>Th image is not found, since browser is using the HTML file as a starting point, instead of the script location. I would like to be able to use the script location as a starting point, just like CSS does. <strong>Is this possible?</strong></p>