Skip to content

Instantly share code, notes, and snippets.

@lightscalar
Created October 22, 2009 22:11
Show Gist options
  • Save lightscalar/216392 to your computer and use it in GitHub Desktop.
Save lightscalar/216392 to your computer and use it in GitHub Desktop.
document.observe("widget:frobbed", function(event) {
console.log("Element with ID (" + event.target.id +
") frobbed widget #" + event.memo.widgetNumber + ".");
});
var someNode = $('foo');
someNode.fire("widget:frobbed", { widgetNumber: 19 });
//-> "Element with ID (foo) frobbed widget #19."
When attaching event handlers via Prototype, I've done the following
in the past...
Event.observe(window, 'load', function () {
});
...or stuff like...
Event.observe(element_to_observe, 'change',
event_handler_function_X );
...so try ...
var r = Raphael('plot',100,100);
var plot = r.rect(0,0,100,100);
Event.observe(plot, 'mousemove', function () {
alert("Did it work?");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment