今天无意中又发现一点HTML知识,可以通过条件HTML注释对不同的浏览器显示不同的内容,但是只兼容于IE浏览器5.0以上。
普通注释
<!--[if IE 6]>
<p>Welcome to Internet Explorer 6.</p>
<![endif]-->
含有脚本的注释
<!--[if IE 5]>
<SCRIPT LANGUAGE="Javascript">
alert("Congratulations. You are running IE5 or later!");
</SCRIPT>
<P>Thank you for closing the message box.</P>
<![endif]-->
普通注释
<!--[if IE 6]>
<p>Welcome to Internet Explorer 6.</p>
<![endif]-->
含有脚本的注释
<!--[if IE 5]>
<SCRIPT LANGUAGE="Javascript">
alert("Congratulations. You are running IE5 or later!");
</SCRIPT>
<P>Thank you for closing the message box.</P>
<![endif]-->