JavaScript - "this" as function argument
<p>When my document loads, I'd like to have JavaScript reload my images' sources. To do so, I got the following code in my HTML document:</p>

<pre><code>&lt;img src="#" id="mypic" onload="reloadImage(this);"/&gt;
</code></pre>

<p>and in my JavaScript document:</p>

<pre><code>function reloadImage(imageElement) {
    imageElement.src = "http://www.somedomain.com/image.png";
}
</code></pre>

<p>However, this doesn't work. Am I using <code>this</code> incorrectly, or does the problem lie elsewhere?</p>
