summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/extended/event.js
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts/extended/event.js')
-rw-r--r--framework/Web/Javascripts/extended/event.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js
index a7f58fae..4a35ba78 100644
--- a/framework/Web/Javascripts/extended/event.js
+++ b/framework/Web/Javascripts/extended/event.js
@@ -20,5 +20,26 @@ Object.extend(Event, {
name = 'keydown';
this._observeAndCache(element, name, observer, useCapture);
- }
+ },
+ keyCode : function(e)
+ {
+ return e.keyCode != null ? e.keyCode : e.charCode
+ },
+
+ fireEvent : function(el,type)
+ {
+ if(document.createEvent)
+ {
+ var evt = document.createEvent('HTMLEvents');
+ evt.initEvent(type, true, true);
+ el.dispatchEvent(evt);
+ }
+ else if(el.fireEvent)
+ {
+ el.fireEvent('on'+type);
+ el[type]();
+ }
+ else
+ el[type]();
+ }
}); \ No newline at end of file