[Greasemonkey] creating your own events
Matt Labrum
darktempler at gmail.com
Sun Feb 19 13:57:07 EST 2006
Hello i cant seem to be able to create custom events like i want to be able
to fire custom events that i can listen for with document.addEventListener
('customEvent',func,false)
Ive been googleing and found the following code but it dosnt seem to work
document.addEventListener("customEventThing",alert,false);
var evt = document.createEvent("Events");
evt.initEvent("customEventThing", false, true);
document.dispatchEvent(evt);
it fails with the error of
Error: [Exception... "Unexpected error" nsresult: "0x8000ffff
(NS_ERROR_UNEXPECTED)"
does anyone know of a way to make this work , or another way to fire custom
events?
More information about the Greasemonkey
mailing list