Solve the problem of incompatibility between IE and Firefox for event source
| The code is as follows |
Copy Code |
| function GetEvent () { if (document.all) { return window.event; } Func=getevent.caller; while (Func!=null) { var arg0=func.arguments[0]; if (arg0) { if ((arg0.constructor==event | | arg0.constructor ==mouseevent) || (typeof (arg0) = = "Object" && arg0.preventdefault && arg0.stoppropagation)) { return arg0; } } Func=func.caller; } return null; } |
jquery compatible with IE and Firefox Firefox's carriage return event
| The code is as follows |
Copy Code |
$ (document). Ready (function () { $ ("Press Enter Control"). KeyDown (function (e) { var curkey = E.which; if (Curkey = = 13) { $ ("#回车事件按钮控件"). Click (); return false; } }); }); |
jquery Multi-browser capture carriage return event code
| The code is as follows |
Copy Code |
$ (document). KeyDown (function (event) { if (Event.keycode = = 13) { $ (' form '). each (function () { The code that you want to run }); } }); |
KeyUp event in Firefox the solution of incompatibility problem original writing:
| The code is as follows |
Copy Code |
$ (' #txt_nums_person '). KeyUp (function () { Alert (' IE is incompatible with Firefox '); }); |
Modify the wording:
| The code is as follows |
Copy Code |
$ (' #txt_nums_person '). Bind (' KeyUp ', function () { Alert (' IE compatible Firefox is also compatible '); }); |