Pass variable to JS file
<p>Although this question have been asked and answered before, including on this website, I am not managing to solve my problem.</p>

<p>I am using Masterpages, and Javascript files... and everyone now how "tricky" masterpages get with relative paths...</p>

<p>Well, I am using a png fix called: unit Png Fix (quite good to be honest... even better than the JQuery one), and this fix needs to use a small image called clear.gif.
The path to the clear.gif file is being stored inside a variable that is in the JavaScript file.</p>

<p>However, and since I am using Masterpages I cannot simply open the JS File and write a static path... has i thought.</p>

<p>What I tried was: remove the variable from the JS File, and declare it outside, but in the sabe Script block. Like this:</p>

<pre><code> &lt;!--[if lt IE 7]&gt;
        &lt;script src="&lt;%= ResolveClientUrl("~/masterpages/js/unitpngfix.js") %&gt;" type="text/javascript"&gt;
            var clear="&lt;%= ResolveClientUrl("~/masterpages/img/clear.gif") %&gt;";
        &lt;/script&gt;
&lt;![endif]--&gt;
</code></pre>

<p>I even tried to declare it in the Head of the website. (I'm placing my JS files at the bottom of my page, to speed it up).</p>

<p>Unfortunately my solutions didn't work... which is why i am doing this question here. :(</p>
