Add a function to a button made with userscript : <p>I know how to create a button with userscript, but I don't know how to attach a function to the button with userscript. How do I attach a function to the button with userscript? I would also like to add an "id" to the button with userscript. How do I do that? Thanks. </p>

<pre><code>var button = document.createElement("BUTTON");        // Create a &lt;button&gt; element
var text = document.createTextNode("CLICK ME");       // Create a text node
button.appendChild(text);                                // Append the text to &lt;button&gt;
document.body.appendChild(button);

function clickMe() {
alert("Hi");
} //end of function clickMe()
</code></pre>
