Click to See Complete Forum and Search --> : String variable with a & in it


CJE
01-15-2003, 09:58 AM
I am using Javascript on a ColdFusion page. I am pulling a name of a company out of a database and using it in the ColdFusion page, and the name has an ampersand sign in it. For Example Allied Machine & Engineering Corp. The name is stored in a ColdFusion variable. Then I take the variable and put it into a javascript variable to use in the javascript code to pass it to a ColdFusion popup window. It works like a champ for a name like AMEC, but as soon as I get a name with an & in it it dies. It will only pass the part of the name before the &. It does not pass the & or anything after that. Is there a way in javascript that I can pass a name with an ampersand sign in it in a variable? Thanks in advance for any help on this issue.

CJ
www.alliedmachine.com

khalidali63
01-15-2003, 10:07 AM
Typically JavaScript should not have a problem with this,my guess would be the ColdFusion part( may be)
In anycase if you want to display that variable value in HTML eventually then you should use pre-defined entities for HTML

replace & with &

I hope this works for you

Khalid

khalidali63
01-15-2003, 10:11 AM
oops...
replace
& with

&

CJE
01-15-2003, 10:23 AM
Thanks for the help, I will try to replace the &