Well I\'m simply playing around with a userscript of GreaseMonkey and here\'s just something simple I attempt to do;
function test() {
document.getElementById(\'
When you write document.onload = test()
, you are calling the test
function, and assigning its return value to the onload
handler. This is clearly not what you intended.
document.onload = test;
This will assign a reference to the test
function to the onload
handler. When the event fires, that is when your function will be called.