<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版本不对,还是怎么回事。
