例如,
<span class="hotspot"
onmouseover="tooltip.show('<table id=\"test\"><tr><th>123</th></tr><tr><th>123</th></tr></table>');"
onmouseout="tooltip.hide();">porttitor orci</span>
在这里,我试图在表格标签中添加id属性,但我已经使用了&#34;&#34;和&#39;&#39;,所以有些东西搞砸了,不能正常工作。
有什么好的解决方案吗?
答案 0 :(得分:4)
<span class="hotspot"
onmouseover="tooltip.show('<table id="test"><tr><th>123</th></tr><tr><th>123</th></tr></table>');"
onmouseout="tooltip.hide();">porttitor orci</span>
答案 1 :(得分:1)
在由Ascii引号(“)分隔的属性值中,您可以使用引用"
呈现Ascii引号。
然而,通常有更好的方法。在给定的情况下,您可以简单地省略引号,因为id=test
工作正常(除非您使用的是XML内容类型的XHTML,并且很可能不是)。