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 / jsstringformat.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  921 b   |  30 lines

  1. <!-----------------------------------------------------------
  2.   This example illustrates use of the JSStringFormat function. 
  3.   ----------------------------------------------------------->
  4. <HTML>
  5. <HEAD>
  6. <TITLE>JSStringFormat</TITLE>
  7. </HEAD>
  8.  
  9. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  10. <BODY  bgcolor="#FFFFD5">
  11.  
  12. <H3>JSStringFormat</H3>
  13.  
  14. <CFSET stringValue = "An example string value with a tab chr(8)        , a newline (chr10)
  15. and some ""quoted"" 'text'">
  16.  
  17. <P>This is the string we have created:<BR>
  18. <CFOUTPUT>#stringValue#</cfoutput>
  19. </P>
  20. <CFSET jsStringValue = JSStringFormat(#stringValue#)>
  21.  
  22. <!----------------------------------------------------------------------
  23. Here we generate an alert from the JavaScript string jsStringValue.
  24. ----------------------------------------------------------------------->
  25. <SCRIPT>
  26. s="<CFOUTPUT>#jsStringValue#</CFOUTPUT>";
  27. alert(s); 
  28. </SCRIPT> 
  29. </BODY>
  30. </HTML>