home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / cfscript.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.1 KB  |  48 lines

  1. <!--- This example shows the use of CFSCRIPT --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>CFSCRIPT Example</TITLE>
  5. </HEAD>
  6.  
  7. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  8. <BODY  bgcolor="#FFFFD5">
  9.  
  10. <H3>CFSCRIPT Example</H3>
  11.  
  12. <P>CFSCRIPT adds a simple scripting language to Cold Fusion
  13. for those developers who are more comfortable with Javascript 
  14. or VBScript syntax.
  15.  
  16. <P>This simple example shows variable declaration and
  17. manipulation.
  18.  
  19. <CFIF IsDefined("form.myValue")>
  20. <CFIF IsNumeric(form.myValue)>
  21. <CFSET x=form.myValue>
  22.  
  23. <CFSCRIPT>
  24. y = x;
  25. z = 2 * y;
  26. StringVar = form.myString;
  27. </CFSCRIPT>
  28.  
  29. <CFOUTPUT>
  30. <P>twice #x# is #z#.
  31. <P>Your string value was: <B><I>#StringVar#</I></B>
  32. </CFOUTPUT>
  33. <CFELSE>
  34. <H3>Please enter a valid number</H3>
  35. </CFIF>
  36. </CFIF>
  37.  
  38. <FORM ACTION="cfscript.cfm" METHOD="post">
  39. <P>Input a value, and then run the template to double the value.
  40. <P><INPUT TYPE="Text" NAME="myValue" VALUE="45">
  41. <P>Input a string, and see it appear as well.
  42. <P><INPUT TYPE="Text" NAME="myString" VALUE="This is a sample string">
  43. <P><INPUT TYPE="Submit" NAME="" VALUE="double my value">
  44. </FORM>
  45.  
  46. </BODY>
  47. </HTML>       
  48.