漫漫技术人生路

C#

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
下面一段代码是测试在微软的IE浏览器下的条件注释语句的效果
程序代码 程序代码
<!--[if IE]>
<h1>您正在使用IE浏览器</h1>
<![endif]-->
<!--[if IE 5]>
<h1>版本 5</h1>
<![endif]-->
<!--[if IE 5.0]>
<h1>版本 5.0</h1>
<![endif]-->
<!--[if IE 5.5]>
<h1>版本 5.5</h1>
<![endif]-->
<!--[if IE 6]>
<h1>版本 6</h1>
<![endif]-->
<!--[if IE 7]>
<h1>版本 7</h1>
<![endif]-->
下面的代码是在非IE浏览器下运行的条件注释
程序代码 程序代码
<!--[if !IE]><!-->
<h1>您使用不是 Internet Explorer</h1>
<!--<![endif]-->
最终在非IE和特殊的IE浏览器下起作用
(或者使用 lte lt 或者 gt gte来判断,如:
<!--[if lte IE 6]>
 在IE 6下显示的信息
<![endif]--> 
).

<!--[if IE 6]><!-->
<h1>您正在使用Internet Explorer version 6<br />
或者 一个非IE 浏览器</h1>
<!--<![endif]-->

-------------------------------------------------
<HTML>
<HEAD>
<TITLE>if IE-www.51windows.Net</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Author" CONTENT="51windows,海娃,haiwa">
<META NAME="Description" CONTENT="Power by 51windows.Net">
</HEAD>

<BODY>
<!--[if gte IE 5]>
<li>IE 5.0 - 6.x
<![endif]-->
<!--[if IE 5]>
<li>IE 5.0
<![endif]-->
<!--[if IE 5.5000]>
<li>IE 5.5
<![endif]-->
<!--[if IE 6]>
<li>IE 6.0
<![endif]-->
<!--[if gte IE 5.5000]>
<li>IE 5.5 - 6.x
<![endif]-->
<!--[if lt IE 6]>
<li>IE 5.0 - 5.5
<![endif]-->
</BODY>
</HTML>


<div style="position: absolute; top: 10; right: 10; width: 148; height: 18;cursor:hand">
<input type="button" name="Button" value="查看源代码" onClick= 'window.location = "view-source:" + window.location.href'></div>
posted on 2006-09-30 15:43  javaca88  阅读(209)  评论(0编辑  收藏  举报