Encloses a code segment containing cfscript
.
Web application framework tags
<cfscript> cfscript code goes here </cfscript>
cfapplication,
cflock,
cfassociate,
cfmodule,
cfauthenticate,
cfimpersonate
Use cfscript
to perform processing in cfscript
instead of CFML. Note the following:
cfscript
uses ColdFusion functions, expressions, and operators
cfscript
One use of cfscript
is to wrap a series of assignment functions that would otherwise require cfset
statements.
Note If you use |
For more information, see Developing ColdFusion Applications.
<!--- This example shows the use of cfscript ---> <html> <head> <title>cfscript Example</title> </head> <body bgcolor = silver> <H3>cfscript Example</H3> <P>cfscript adds a simple scripting language to ColdFusion for those developers who are more comfortable with JavaScript or VBScript syntax. <P>This simple example shows variable declaration and manipulation. <cfif IsDefined("form.myValue")> <cfif IsNumeric(form.myValue)> <cfset x = form.myValue> <cfscript> y = x; z = 2 * y; StringVar = form.myString; </cfscript> <cfoutput> <P>twice #x# is #z#. <P>Your string value was: <B><I>#StringVar#</I></B> </cfoutput> <cfelse> ...