summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/extended/event.js
diff options
context:
space:
mode:
authorwei <>2006-01-21 02:07:59 +0000
committerwei <>2006-01-21 02:07:59 +0000
commit407aa2ff5d56859fcd1f47b85b4c4180d035c428 (patch)
tree7c4442ad2652f3021a969391fd8a468ca9400100 /framework/Web/Javascripts/extended/event.js
parentf74267f8927d39b5cb3dc43203060488371127c9 (diff)
Fixed DefaultButton and TLinkButton
Diffstat (limited to 'framework/Web/Javascripts/extended/event.js')
-rw-r--r--framework/Web/Javascripts/extended/event.js33
1 files changed, 30 insertions, 3 deletions
diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js
index a7514cda..b6dccf3b 100644
--- a/framework/Web/Javascripts/extended/event.js
+++ b/framework/Web/Javascripts/extended/event.js
@@ -26,12 +26,39 @@ Object.extend(Event, {
return e.keyCode != null ? e.keyCode : e.charCode
},
+ isHTMLEvent : function(type)
+ {
+ var events = ['abort', 'blur', 'change', 'error', 'focus', 'load', 'reset', 'resize', 'scroll', 'select', 'submit', 'unload'];
+ return events.include(type);
+ },
+
+ isMouseEvent : function(type)
+ {
+ var events = ['click', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup'];
+ return events.include(type);
+ },
+
fireEvent : function(element,type)
{
if(document.createEvent)
- {
- var event = document.createEvent('HTMLEvents');
- event.initEvent(type, true, true);
+ {
+ if(Event.isHTMLEvent(type))
+ {
+ var event = document.createEvent('HTMLEvents');
+ event.initEvent(type, true, true);
+ }
+ else if(Event.isMouseEvent(type))
+ {
+ var event = document.createEvent('MouseEvents');
+ event.initMouseEvent(type,true,true,
+ document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
+ }
+ else
+ {
+ if(Logger)
+ Logger.error("undefined event", type);
+ return;
+ }
element.dispatchEvent(event);
}
else if(element.fireEvent)