Hi Guys I have this string <a href=javascript:// onClick="changeImageInfo('$listing_url$/images/$file$','$desc$');return false;"> <img src="$listing_url$/images/$thumbnail$"> and when someone add a ' or '' in the description who is describe as $desc$ I have a javascript error. How can I escape the strings, so ' and " become \' and \" . Bobby
Hi nico Thanks for your answer but the page is not a php so I can't use it. Anybody else with another solution please?
I thought these were PHP variables. Where does $desc$ come from then? And what is it? Once the Javascript is outputted wrong, there's no way to fix it later. You have to make sure these replacements take place before they're outputted.
Hi bro thanks for your answer. $desc$ is a term in a perl script to show the description that someone give to a picture. Maybe that I need to change it directly in the perl script itself? If so are you looking for a small job like that if you know perl language? Let me know Bobby
Sorry, I don't know anything about Perl. But yes, you will have to apply a function to the variable before outputting it.