JSDG 13.6

拜拜、爱过 提交于 2020-03-09 04:40:49
<script type="text/javascript">
/*@cc_on
  @if (@_jscript)
    // This code is inside a conditional comment, which is also a
    // regular JavaScript comment. IE runs it but other browsers ignore it.
    alert('You are using Internet Explorer);
  @else*/
    // This code is no longer inside a JavaScript comment, but is still
    // inside the IE conditional comment.  This means that all browsers
    // except IE will run this code.
    alert('You are not using Internet Explorer');
/*@end
  @*/
</script>

 按理说这是IE中javascript条件注释。

以/*@cc_on 开头,@*/结束的。而且JScript是Microsoft自己的JavaScript解释器的名字,而@_jscript变量在IE中为True。

但我在IE7中,似乎认不到条件注释。

firefox却可以。不知道是IE版本不对,还是怎么回事。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!