Link to home
Start Free TrialLog in
Avatar of jfergy
jfergy

asked on

Double to single to double quotes

Hello-

Where it says "<%=getdata("description")%>", may have single quotes inside. How can I keep Javascript from erring out when it sees that inside the string? Do I need double quote twice then single outside or?

Thanks

<img src="yourSrc" name="Photo" />
<span id="PhotoDescription"></span>

ONMOUSEDOWN="document.images['Photo'].src='/mypictures/pic.jpg'; document.getElementById('PhotoDescription').innerHTML = '<%=getdata("description")%>';"

Avatar of BogoJoker
BogoJoker

You should use an asp function, in php there i mysql_real_escape_string($description) let me see if there is a simliar function for ASP.
ASKER CERTIFIED SOLUTION
Avatar of BogoJoker
BogoJoker

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfergy

ASKER

Thanks that worked great. I made it a little simpler though:

<%=Replace(getpix("Description"), "'", "\'")%>
Hehe, nice thinking, I'm no good with ASP, I am a php guy =)
Avatar of jfergy

ASKER

Thanks for the help. I used php quite a while ago until Microsoft servers caught up to the usability of apache. Now im just MS.