如何不在lt IE 9中加载javascript代码
我在项目中使用javascript代码,我不想在lt IE 9中加载此代码。我使用此代码,但它不起作用:如何不在lt IE 9中加载javascript代码,javascript,internet-explorer,conditional-comments,Javascript,Internet Explorer,Conditional Comments,我在项目中使用javascript代码,我不想在lt IE 9中加载此代码。我使用此代码,但它不起作用: <!--[if lt IE 9]> <script type="text/javascript"> .... </script> <![endif]--> ... 您可以访问此网站,了解如何构建更复杂的条件注释。请尝试以下操作: <!--[if gte IE 9]>--> ... <!--<![endif]
<!--[if lt IE 9]>
<script type="text/javascript">
....
</script>
<![endif]-->
...
您可以访问此网站,了解如何构建更复杂的条件注释。请尝试以下操作:
<!--[if gte IE 9]>-->
...
<!--<![endif]-->
...
因此,不妨尝试一下:
<!-- Target IE 9 and lower -->
<!--[if lt IE 10]>
<script type="text/javascript">alert('hello world');</script>
<![endif]-->
<!-- Target IE 8 and lower -->
<!--[if lt IE 9]>
<script type="text/javascript">alert('hello world');</script>
<![endif]-->
<!-- Target IE 9 and lower -->
<!--[if lt IE 10]>
<script type="text/javascript">alert('hello world');</script>
<![endif]-->