javascript error apostrophe
i have in my jsp a js function to open a popup, in this function I pass as parameter, this parameter is a message like this
L'appareil est en panne
but when i load my page i have a javascript. how i can i do before i load my page to do this*
L''appareil est en pan开发者_JAVA百科ne
You can escape quotes inside strings using backslashes:
alert('L\'appareil est en panne\'');
there's a Java class that seems to do the job: StringEscapeUtils.escapeJavaScript()
. Boy, you Java guys have a class for everything!
Altough your question is not very clear. But you can use escape character \' to resolve such problems.
精彩评论