View Full Version : Coldfusion strings

05-18-2005, 10:58 PM
I'm using the following statement in javascript/coldfusion and need help:

function somefun()
var myText = <cfoutput>#editor.text#</cfoutput>

The problem is, I need to treat myText as a string, and the #editor.text# contains both " and ' characters.... how do I get around the problem of early string termination and such?
Any help would be appreciated, thanks

05-19-2005, 05:02 PM
i have had similar problems when using WebDNA (tag based server side scripting language). I had to grep the variable before it was sent to the browser. Just use regular expressions to replace " with \" and ' with \'. you may not need to do both. it depends on what your wrapping the js var with ( var txt ="hi" or var txt ='hi' ).

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum