开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜