Javascript 如何停止仅用于IE 8的脚本
我必须停止下面提到的IE8和IE7上的javascript文件。当我删除'responsive nav.js'时,响应导航在IE更高版本上不起作用。因此,请任何人建议停止IE8和IE7的工作Javascript 如何停止仅用于IE 8的脚本,javascript,html,Javascript,Html,我必须停止下面提到的IE8和IE7上的javascript文件。当我删除'responsive nav.js'时,响应导航在IE更高版本上不起作用。因此,请任何人建议停止IE8和IE7的工作 <script type="text/javascript" src="js/responsive-nav.js"></script> 您可以使用下层显示条件注释: <![if IE gt 8]><script ...></script><
<script type="text/javascript" src="js/responsive-nav.js"></script>
您可以使用下层显示条件注释:
<![if IE gt 8]><script ...></script><![endif]>
但是请注意,使用这样的注释将导致您的页面由于“未知标记”而无法通过验证。
。。。
这称为条件语句。“IE”之前的“!”表示“不是”,因此该语句表示:如果此浏览器不是IE,请运行此脚本
您还可以针对特定版本的IE,如下所示:
<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]-->
<!--[if IE 8]>
Special instructions for IE 6 here
<![endif]-->
<!--[if IE 8]>
Special instructions for IE 6 here
<![endif]-->
您能详细说明为什么需要停止吗?为什么不花点时间弄清楚如何让它正常工作呢?有一个很棒的脚本叫做它,正是为了这个目的而设计的
<!--[if !IE 8]><!-->
<script type="text/javascript" src="js/responsive-nav.js"></script>
<!--<![endif]-->
<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]-->
<!--[if IE 8]>
Special instructions for IE 6 here
<![endif]-->
<!--[if IE 8]>
Special instructions for IE 6 here
<![endif]-->