Click to See Complete Forum and Search --> : having a problem with single quote


jackbowers
May 14th, 2003, 07:25 PM
hello all. how can i get rid off the single quote.

i have a function that i am passing 4 parameters to it.

function getvalue(one,two,three,four){

document.form.ftextb.value=one;
document.form.ftextc.value=two;
document.form.ftextd.value=three;
document.form.ftexte.value=four;
}

when i call the function i am passing

getvalue('<%=one%>','<%=two%>','<%=three%>','<%=four%>')

i am running into the problem of
some data having single quote like
'O' Donnel' and i am getting an error. how can i get rid of that
in javascript

thank you in advance

antares686
May 15th, 2003, 06:06 AM
On you server side is it is VBScript which is default then do comething like this.



getvalue('<%=replace(one,"'","\'")%>','<%=replace(two,"'","\'")%>','<%=replace(three,"'","\'")%>','<%=replace(four,"'","\'")%>')

This will cause it to read like so.


getvalue('O\'Donnel', ...

and should take care of the problem.