Home > Web Front-end > JS Tutorial > Let the web page display different content according to different IE versions_javascript skills

Let the web page display different content according to different IE versions_javascript skills

WBOY
Release: 2016-05-16 18:56:10
Original
1302 people have browsed it

This blog mainly talks about how to make static HTML code display different content according to different IE versions. The trick here is to take advantage of IE's HTML comment expressions.
The comment format of HTML is . IE has made some extensions to HTML comments so that it can support conditional expressions:
When expression is True, HTML content is displayed.
Example:

Copy code The code is as follows:




Similar to programming languages, the expressions here Operators such as greater than (gt), less than (lt), AND, or NOT are also supported. Here are some examples.
[if IE] Determines whether it is IE
[if IE 7] Determines whether it is IE7
[if !IE] Determines whether it is not IE
[if lt IE 5.5] Determines whether it is IE5.5 or below Version. (<)
[if lte IE 6] Determine whether it is equal to IE6 version or below (<=)
[if gt IE 5] Determine whether IE5 or above version (> )
[if gte IE 7] Determine whether it is IE7 version or above
[if !(IE 7)] Determine whether it is not IE7
[if (gt IE 5)&(lt IE 7)] Determine whether it is greater than IE5 and less than IE7
[if (IE 6)|(IE 7)] Determine whether IE6 or IE7
Code example:
Copy code Code As follows:


You are not using Internet Explorer.