home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / cfscript.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.1 KB  |  46 lines

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