内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

HTML注釋表達(dá)式判斷IE版本

2024-01-14    分類(lèi): 網(wǎng)站建設(shè)

如何讓靜態(tài)HTML代碼根據(jù)不同IE版本顯示不同內(nèi)容。 這里的技巧就是利用IE的HTML注釋表達(dá)式。

HTML 的注釋格式是 <!-- Comment content --> , IE 對(duì)HTML注釋做了一些擴(kuò)展,使之可以支持條件判斷表達(dá)式:

<!--[if expression]> HTML <![endif]--> 當(dāng)表達(dá)式expression 為T(mén)rue 的時(shí)候,顯示 HTML 內(nèi)容。

例子:

view plaincopy to clipboardprint? <!--[if IE 5]> <p>Welcome to Internet Explorer 5.</p> <![endif]--> <!--[if IE 5]> <p>Welcome to Internet Explorer 5.</p> <![endif]-->

和編程語(yǔ)言類(lèi)似,這里的表達(dá)式還支持大于(gt)、小于(lt)、與或非 等操作符。 下面是一些例子。

[if IE] 判斷是否IE

[if IE 7] 判斷是否是IE7

[if !IE] 判斷是否不是IE

[if lt IE 5.5] 判斷是否是IE5.5 以下版本。 (<)

[if lte IE 6] 判斷是否等于IE6 版本或者以下 (<=)

[if gt IE 5] 判斷是否IE5以上版本 (> )

[if gte IE 7] 判斷是否 IE7 版本或者以上

[if !(IE 7)] 判斷是否不是IE7

[if (gt IE 5)&(lt IE 7)] 判斷是否大于IE5, 小于IE7

[if (IE 6)|(IE 7)] 判斷是否IE6 或者 IE7

代碼示例:

view plaincopy to clipboardprint? <!--[if IE]><p>You are using Internet Explorer.</p><![endif]--> <![if !IE]><p>You are not using Internet Explorer.</p><![endif]>

<!--[if IE 7]><p>Welcome to Internet Explorer 7!</p><![endif]--> <!--[if !(IE 7)]><p>You are not using version 7.</p><![endif]-->

<!--[if gte IE 7]><p>You are using IE 7 or greater.</p><![endif]--> <!--[if (IE 5)]><p>You are using IE 5 (any version).</p><![endif]--> <!--[if (gte IE 5.5)&(lt IE 7)]><p>You are using IE 5.5 or IE 6.</p><![endif]--> <!--[if lt IE 5.5]><p>Please upgrade your version of Internet Explorer.</p><![endif]--> <!--[if IE]><p>You are using Internet Explorer.</p><![endif]--> <![if !IE]><p>You are not using Internet Explorer.</p><![endif]>

<!--[if IE 7]><p>Welcome to Internet Explorer 7!</p><![endif]--> <!--[if !(IE 7)]><p>You are not using version 7.</p><![endif]-->

<!--[if gte IE 7]><p>You are using IE 7 or greater.</p><![endif]--> <!--[if (IE 5)]><p>You are using IE 5 (any version).</p><![endif]--> <!--[if (gte IE 5.5)&(lt IE 7)]><p>You are using IE 5.5 or IE 6.</p><![endif]--> <!--[if lt IE 5.5]><p>Please upgrade your version of Internet Explorer.</p><![endif]-->

新聞標(biāo)題:HTML注釋表達(dá)式判斷IE版本
分享地址:http://www.rwnh.cn/news31/313681.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司搜索引擎優(yōu)化、商城網(wǎng)站、網(wǎng)站維護(hù)、手機(jī)網(wǎng)站建設(shè)品牌網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)
游戏| 武汉市| 屏东县| 柘荣县| 东阿县| 兴和县| 五峰| 梅州市| 海伦市| 长顺县| 博白县| 福海县| 邯郸市| 莆田市| 揭东县| 桐梓县| 辽宁省| 吴江市| 八宿县| 思茅市| 莒南县| 彭山县| 江安县| 宜兴市| 镇坪县| 肃南| 海宁市| 昌都县| 永昌县| 鲁甸县| 英吉沙县| 郸城县| 甘肃省| 额尔古纳市| 沁水县| 灯塔市| 玉山县| 弋阳县| 合作市| 蕉岭县| 兴仁县|