JSSTRINGFORMAT  
説明

引用符 (')、二重引用符 (")、および改行などの JavaScript 特殊文字をエスケープします。

 
戻り値

JavaScript で安全に使用できる文字列

 
カテゴリ

文字列関数

 
関数のシンタックス
JSStringFormat(string)
 
パラメータ

 
使用方法

この関数により JavaScript の特殊文字がエスケープされるため、JavaScript の中に任意の文字列を安全に入力できます。

 
<!--- この例は、JSStringFormat 関数の使用方法を示しています。 ---->
<h3>JSStringFormat の例</h3>
<cfset stringValue = "An example string value with a tab chr(8), a newline (chr10) and 
some ""quoted"" 'text'">

<p>作成した文字列 : <br>
<cfoutput>#stringValue#</cfoutput>
</p>
<cfset jsStringValue = JSStringFormat(#stringValue#)>
<!----- JavaScript 文字列 jsStringValue から警告を生成 ---->
<SCRIPT>
s = "<cfoutput>#jsStringValue#</cfoutput>";
alert(s);
</SCRIPT> 

STRING  
文字列、または文字列を含んでいる変数です。