escape apostrophe's in cf cariable

Posted on 2004-08-25
Last Modified: 2013-12-16
I am using the Overlib js file for some custom tooltips on my pages. In order to pass the text from my coldfusion variable into the ToolTip function I call it like this:

onmouseover="return overlib('#problem#');" onmouseout="return nd();"

The error occurs when the #problem# variable conatins apostrophes, for obvious reasons. I am wondering if anyone has some code that will escape all of the apostrophes in the #problem# variable and return with all of the ' turned into /' (if that's right, I think)  Keep in mind I need to be able to pass #problem# as a parameter of the function.

Once again, I deeply appreciate everyone's support.

Question by:FirePits
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 14

Expert Comment

ID: 11898604
Try this:

onmouseover="return overlib(escape('#problem#'));"

Then, in the overlib function:

function overlib(xValue){
      document.write('This is the Value sent: '+unescape(xValue));
~~ Other code ~~


So, where you want to insert the value of #problem# in your overlib code, instead use "unescape(xValue)".

Hope that helps, not sure though without seeing more code.


Accepted Solution

reggi635 earned 250 total points
ID: 11904247
onmouseover="return overlib('#JSStringFormat(problem)#');" onmouseout="return nd();"

JSStringFormat is a inbuilt ColdFusion to do the same as escape.


Author Comment

ID: 11905202

Expert Comment

ID: 11906249
You are welcome.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure ( It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: : Click on Too…
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question