最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - if IE conditional comments not working - Stack Overflow

programmeradmin1浏览0评论

It seems like a silly question, but I'm stumped.

I'm using an if IE conditional statement to fix some issues in IE6.

In the head, I have

<!--[if lt IE 7] > <script type="text/javascript" src="js/ie6.js"></script> < ![endif]-->

And in the ie6.js file, I have a simple alert, which works when I take it out of the conditional ment. But in IE, the alert does not show. I am testing on IE 6.0.2900 on Windows XP in Parallels Desktop.

It seems like a silly question, but I'm stumped.

I'm using an if IE conditional statement to fix some issues in IE6.

In the head, I have

<!--[if lt IE 7] > <script type="text/javascript" src="js/ie6.js"></script> < ![endif]-->

And in the ie6.js file, I have a simple alert, which works when I take it out of the conditional ment. But in IE, the alert does not show. I am testing on IE 6.0.2900 on Windows XP in Parallels Desktop.

Share Improve this question edited Aug 26, 2010 at 14:23 Gian 14k49 silver badges54 bronze badges asked Aug 26, 2010 at 14:19 Mike EngMike Eng 1,6915 gold badges36 silver badges56 bronze badges 1
  • Have you tried displaying the browser information in javascript to make sure it is IE6? Wonder if the VM is choosing a different version of installed IE. – Jay Commented Aug 26, 2010 at 14:28
Add a ment  | 

1 Answer 1

Reset to default 7

Try it without spaces in the tags:

<!--[if lt IE 7]>
According to the conditional ment this is Internet Explorer lower than 7
<![endif]-->
发布评论

评论列表(0)

  1. 暂无评论