Let the webpage display different content based on different IE versions _ javascript skills

Source: Internet
Author: User
Tags html comment
In the previous blog "Judging the current webpage display mode in IE8", I mentioned that IE has different display modes and how to use Javascript to dynamically determine. Web developers can import different content according to different display modes. This blog mainly describes how to make static HTML code display different content based on different IE versions. The trick here is to use the HTML comment expression of IE.
The HTML comment format is IE has made some extensions to HTML comments so that it can support conditional judgment expressions:
When expression is True, HTML content is displayed.
Example:

The Code is as follows:





Similar to programming languages, the expressions here also support operators such as greater than (gt), less than (lt), and or not. The following are some examples.
[If IE] determine whether IE
[If IE 7] determining whether it is IE7
[If! IE] determine if it is not IE
[If lt IE 5.5] determines whether it is IE5.5 or earlier. (<)
[If lte IE 6] determining whether it is equal to IE6 or earlier (<=)
[If gt IE 5] determine whether IE5 or later is used (>)
[If gte IE 7] determine whether IE7 or later is used
[If! (IE 7)] determine if it is not IE7
[If (gt IE 5) & (lt IE 7)] judge whether it is greater than IE5 and less than IE7
[If (IE 6) | (IE 7)] determine whether IE6 or IE7 is used
Sample Code:

The Code is as follows:



You are not using Internet Explorer.







Related Article

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.