JS determines browser type
$.browser object
$.browser.version browser version
The code copy is as follows:
var binfo = '';
if ($.browser.msie) { binfo = "Microsoft Internet Explorer " + $.browser.version; }
else if ($.browser.mozilla) { binfo = "Mozilla Firefox " + $.browser.version; }
else if ($.browser.safari) { binfo = "Apple Safari" + $.browser.version; }
else if ($.browser.opera) { binfo = "Opera " + $.browser.version; }
else {
binfo = "google";
}
alert(binfo);
Just write the previous code directly into <script></script>
js judge ie6 not to execute
The code copy is as follows:
if ($.browser.msie && $.browser.version <= 6.0)
return false;
$.browser.msie determines whether it is an ie browser
$.browser.version <= 6.0 Determines that ie is less than or equal to ie6
return flash does not execute
For example, there is a piece of code that is a pop-up box. If it is ie6 and does not execute, everything else will be executed, and the code can be operated as follows:
The code copy is as follows:
function nextPopBox1() {
if ($.browser.msie && $.browser.version <= 6.0)
return false;
layer.closeAll();
$.layer({
type: 1,
shade: [0.5, '#000', true],
border: false,
bgcolor: '',
fix: false,
title: false,
page: { dom: '#img2' },
area: ['724px', '302px'],
closeBtn: false
});
}
Another example is, for example, there is a piece of code that ie6 does not execute, and everything else is executed. The code can be written as follows:
The code copy is as follows:
function webJs() {
if (!$.browser.msie && ($.browser.version != "6.0")) {
$("#fastNav li:gt(0)").hover(function () {
$(this).stop().animate({ marginLeft: "10px" }, 'fast');
}, function () {
$(this).stop().animate({ marginLeft: "0px" }, 'fast');
});
}
}