Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
@cc_on Statement

@cc_on Statement

Activates conditional compilation support within comments in a script.


The @cc_on statement can turn on conditional compilation within comments in a script.

It is not common to use conditional compilation variables in scripts written for ASP or ASP.NET pages or command-line programs. This is because the capabilities of the compilers can be determined by using other methods.

When you write a script for a Web page, always put conditional compilation code in comments. This enables hosts that do not support conditional compilation to ignore this code.

An @if or @set statement outside of a comment also activates conditional compilation.

The following example illustrates the use of the @cc_on statement.

/*@cc_on @*/
    document.write("JScript version: " + @_jscript_version + ".");
    document.write("<br />");
    @if (@_win32)
        document.write("Running on the 32-bit version of Windows.");
    @elif (@_win16)
        document.write("Running on the 16-bit version of Windows.");
        document.write("Running on a different operating system.");

Community Additions

© 2015 Microsoft