These two days in contact with JQuery Easyui (http://jquery-easyui.wikidot.com/), when the call to Window.event found that Firefox in the call event some compatibility issues:
After the Firefox page call, its Windows.event object is undefined:
if (typeof (window.event) = = ' undefined ') alert (' Window.event is undefined. '); else alert (' window.event is defined. ');
The above code executes in Firefox with the result: "Window.event is undefined." Execution results in IE and chrome: "window.event is defined."
Calling the event in Firefox requires passing a parameter event in the calling method, but some actions in the jquery Easyui cannot pass custom parameters, such as Onchick (node) in the tree, which can only pass the node parameter. To solve this problem, the page needs to execute the following code when it loads, initializing an event to solve the problem:
function Loadevent () {if (!document.all) {window.constructor.prototype. __definegetter__ ("Event", function () {var func = Arguments.callee.caller; while (func!= null) {var arg0 = func.arguments[0]; if (arg0 && (arg0.constructor = = Event | | arg0.constructor = = MouseEvent)) {return arg0;} func = Func.caller; return null; }); } }
There are also different calling methods for obtaining the mouse current coordinates in Firefox:
menu_x = Event.x? Event.x:event.pagex; Menu_y = Event.y? Event.y:event.pagey;
In IE and chrome, you can get mouse coordinates using event.x and Event.y, and in Firefox you need to use Event.pagex and event.pagey to get them.