【发布时间】:2011-10-23 00:14:40
【问题描述】:
根据这个similar post,我尝试了以下但没有成功,并指出错误:
onclick="alert('This is my \"quoted text:\"');" (no browser response)
onclick="alert('This is my \\"quoted text:\\"'); (no browser response)
onclick="alert('This is my "quoted text:"');" (comes out as: This is my "quoted text:")
onclick="alert('This is my \x22quoted text:\x22');" (grails .gsp page preprocessor chokes on this)
除了将警报放入函数之外,还有什么想法吗?我想有办法在 html/javascript 中做到这一点?
注意:我更新了标题以限定使用 Grails 的问题。以下所有解决方案通常都可以正常工作,但不适用于 grails 1.3.7。根据 MaxArt 的指示,在上述版本 4 中,在每个反斜杠之前添加了一个额外的反斜杠。
【问题讨论】:
标签: javascript html grails