Alternative to document.getElementById().setAttribute() function
<p>Is there any alternative to doing the following line:</p>

<pre><code> document.getElementById("btn").setAttribute("onclick", "save(" + id + ");");
</code></pre>

<p>This line basically changes the <code>onclick()</code> event of a button to something like: <code>save(34); , save(35);</code> etc. However it fails in IE 7 and 6 but works in IE 8 and Firefox.</p>

<p>I can use jquery for this as well.</p>
