Not more than ten minutes ago, I decided to write my first script for Greasemonkey. I have no experience with him. Also, my JavaScript is a bit rusty, as it has been a while since I last wrote the code. But I can not understand why Greasemonkey gives me this error:
Line: 9 Char: 2 Error: 'document' is undefined Code: 800A1391 Source: Microsoft JScript runtime error
Here is my script:
// ==UserScript== // @name Easier WatchSeries // @namespace n/a // @include http://www.watch-series.com/episode/* // ==/UserScript== function thing() { document.body.setAttribute('onload', show_links(document.getElementById('idepisod').value)); } thing();
All I want to do is add the onLoad attribute to the body tag. I get this error when I go to "Manage new user scripts" → "Edit". In addition, the script does nothing, obviously something is wrong.
I am running Firefox 3.6.13.
source share