Javascript does not execute _ javascript when determining the browser type as ie6

Source: Internet
Author: User
This article mainly introduces how to judge the browser type of js and how to not execute the browser type when the type is ie6. If you need it, refer to js to determine the browser type.

$. Browser object
$. Browser. version browser version

The Code 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 );


Write the code above to script and script.

Js judges ie6 is not executed

The Code is as follows:


If ($. browser. msie & $. browser. version <= 6.0)
Return false;


$. Browser. msie determine whether it is an IE browser

$. Browser. version <= 6.0 judge that ie is less than or equal to ie6

Return flase

For example, a piece of code is a pop-up box. If ie6 is not executed and all others are executed, the code can be operated as follows:

The Code 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
});
}


In another example, for example, there is a piece of code, ie6 is not executed, and all others are executed. The code can be written as follows:

The Code is as follows:


Function webJs (){
If (! $. Browser. msie & ($. browser. version! = "6.0 ")){
$ ("# FastNav li: gt (0)"). hover (function (){
$ (This). stop (). animate ({marginLeft: "10px"}, 'save ');
}, Function (){
$ (This). stop (). animate ({marginLeft: "0px"}, 'save ');
});
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.