How jquery determines whether it is an ie6 browser: Use [$.support.style] to determine, the code is [if ($.browser.msie && ($.browser.version == “6.0″) && !$.support.style)].
The operating environment of this tutorial: windows7 system, jquery3.2.1 version, thinkpad t480 computer.
Recommended: jquery video tutorial
Jquery method to determine whether it is an ie6 browser:
jquery API Medium
$.browser Browser kernel identifier Available values: safari opera msie mozilla
$.browser.version Browser rendering engine version number Typical results: Internet Explorer: 6.0, 7.0 Mozilla/Firefox/Flock/Camino: 1.7.12, 1.8.1.3 Opera: 9.20 Safari/Webkit: 312.8, 418.9
$.support.style
A group used to display different browsers Collection of properties for respective features and bugs.
if ($.browser.msie && ($.browser.version == “6.0″) && !$.support.style) { //代码 }
Final complete code:
//判断是否按回车,如果是则提交表单 if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) { $("#login_form").keypress(function(e){ var e = e || window.event; var keycode = e.which || e.keyCode; if (keycode==13) { $("#clogin").trigger("click"); } }); } else { $("#login_form").keydown(function(e){ var e = e || window.event; var keycode = e.which || e.keyCode; if (keycode==13) { $("#clogin").trigger("click"); } }); }
Related free learning recommendations: javascript (Video )
The above is the detailed content of How jquery determines whether the browser is ie6. For more information, please follow other related articles on the PHP Chinese website!