Conditional compilation is activated by using the @cc_on statement, or using an @if or @set statement. Some typical uses for conditional compilation include using new features in JavaScript, embedding debugging support into a script, and tracing code execution.

Always place conditional compilation code in comments, so that hosts (like Netscape Navigator) that do not support conditional compilation will ignore it.

/*@cc_on @*/
/*@if (@_jscript_version >= 4)
    alert("JavaScript version 4 or better");
    @else @*/
    alert("Conditional compilation not supported by this scripting engine.");
/*@end @*/

 

posted on 2013-06-17 19:56  @version  阅读(168)  评论(0)    收藏  举报