Passing parameters to a function in an onclick event
<p>I'm trying to dynamically build some HTML and assign a function to the <code>onclick</code> event of a link. Here's the code I've got...</p>

<pre><code>link = document.createElement("a");
link.setAttribute("href", "#");
link.onclick = function(){someFunction(myObject.id);};
link.appendChild(document.createTextNode("Click Me!"));
</code></pre>

<p>My research has indicated that I wrap my function call within an anonymous function like I have done. What I'm finding though is that my function is called when this bit of script runs instead of on the click event. This seems to be a common problem but I'm following all the advice I've found so far but to no avail.</p>

<p>Any help or pointers is much appreciated.</p>

<p>Mister B.</p>
