Interaction of CFScript with CFML  
 
 

You enclose CFScript regions inside <CFSCRIPT> and </CFSCRIPT> tags. No other CFML tags are allowed inside a CFSCRIPT region.

A CFSCRIPT tag block must contain at least one CFScript statement, and comments are not considered statements. If there are no statements, you should comment out the entire CFSCRIPT block (including its enclosing <CFSCRIPT> and </CFSCRIPT> blocks) with CFML comment tags.

You can read and write ColdFusion variables inside CFScript, as shown in this example:

<CFOUTPUT QUERY="employees">

    <CFSCRIPT>
    //`testres' is a column in the "employees" query

    if( testres EQ 1 )
        result="positive";
    else
        result="negative";

    </CFSCRIPT>

<!--- The variable result takes its
    value from the script region --->

Test for #name# is #result#.

</CFOUTPUT>



 
 
BackUp LevelNext
 
 

allaire     AllaireDoc@allaire.com
    Copyright © 1998, Allaire Corporation. All rights reserved.