Simple replace in database results...please help (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


jonance -> Simple replace in database results...please help (2/24/2008 22:04:24)

Hi,

I have a scrolling marquee script that is in javascript. The marquee contents are within two apostrophes ('content here'). I am using it to display database results in the scroll, however some of my results have apostrophes in them so it throws off the script. Is there a way to REMOVE any apostophes that appear in my results? Here is how i display the results....i'm sure this is simple but i just don't know how to do it.

<%=FP_FieldVal(fp_rs,"realname")%>




Spooky -> RE: Simple replace in database results...please help (2/24/2008 23:47:28)

Try it this way?
<%=replace(FP_Field(fp_rs,"realname"),"'","''")%>

The other way is to remove them completely :
<%=replace(FP_Field(fp_rs,"realname"),"'","")%>




rdouglass -> RE: Simple replace in database results...please help (2/25/2008 9:35:22)

Just my $.02...one more option:

You will need to use the "\" for a JS marquee to show an apostrophe or other special characters. Like so:

<%=replace(FP_Field(fp_rs,"realname"),"'","\'")%>

JavaScript needs to 'escape' those special chars. Hope it helps.




jonance -> RE: Simple replace in database results...please help (2/25/2008 9:37:50)

Thanks alot...I used spooky's to totally omit the apostrophes...but i'm saving all the code for future reference!

Thanks
John




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875