javascript anonymous function : why my script doesn't work
<p>I want to try to a lib ala jquery but I don't understand why my method getUrl doesn't output anything, do you ?</p>

<p>mylib.js</p>

<pre><code>    (function () {

    var scripts = document.getElementsByTagName('script');
    var index = scripts.length - 1;
    var thisScript = scripts[index];

    var myLib = {       
        getUrl: function() {
            return thisScript;
        }               
    }
}

if (!window.$$) {window.$$ = myLib}

)();
</code></pre>

<p>and in mytest.html</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.js"&gt;&lt;/script&gt;
    &lt;script src="mylib.js" type=text/javascript&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;DIV id=url&gt;url&lt;/DIV&gt;   
    &lt;script&gt;
    var url = $$.getUrl();
    jQuery("#url").html(url);
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
