MACROMEDIA COLFUSION MX 7-CFML Reference page 705

Cfml reference
Hide thumbs Also See for COLFUSION MX 7-CFML:
Table of Contents

Advertisement

JSStringFormat
Description
Escapes special JavaScript characters, such as single-quotation mark, double-quotation mark, and
newline.
Returns
A string that is safe to use with JavaScript.
Category
String functions
Function syntax
JSStringFormat(string)
Parameters
Parameter
string
Usage
Escapes special JavaScript characters, so you can put arbitrary strings safely into JavaScript.
Example
<!--- This example shows the use of the JSStringFormat function. ---->
<h3>JSStringFormat</h3>
<cfset stringValue = "An example string value with a tab chr(8),
a newline (chr10) and some ""quoted"" 'text'">
<p>This is the string we have created:<br>
<cfoutput>#stringValue#</cfoutput>
</p>
<cfset jsStringValue = JSStringFormat(#stringValue#)>
<!----- Generate an alert from the JavaScript string jsStringValue. ---->
<SCRIPT>
s = "<cfoutput>#jsStringValue#</cfoutput>";
alert(s);
</SCRIPT>
Description
A string or a variable that contains one.
JSStringFormat
705

Advertisement

Table of Contents
loading

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents