I have a button in asp.net VB that uses an onmouseover to send a text string to a function...
onmouseover="CallFunction(
<%# Eval("ProductID") %>,replaceQuotes('<%# Eval("ProductName") %>'),1);return false;"
Notice I am passing a text string from the table field as the second parameter in the CallFunction. However, if that text string happens to have an apostrophe/single quote or a double quote, I want to call the replaceQuotes function to escape the quotes.
My replaceQuotes function looks like this:
function replaceQuotes(stringPhrase
)
{
<!--
stringPhrase.replace("\"",
""");
stringPhrase.replace("\'",
"\\\'");
return stringPhrase;
//-->
}
However, it still errors and does not seem to escape the apostrophe.
Here is the error:
missing ) after argument list
[Break on this error] CallFunction(4,replaceQuot
es('Chef Anton's Cajun Seasoning'),1);return false;
What am I missing?
thanks.
Start Free Trial