想传递一个javascript functiona的参数,这是一个字符串。这个javascript函数是鼠标悬停的一个提示框..
我正在使用的字符串是这样的:
Hemmed Finish:横幅的每个边/边(1/2“到2”)都折叠并粘合(特殊的乙烯基溶液)或热压。这是最常见和最好的完成选项。 缝合完成:横幅的每个边/边(1“到2”)在后面折叠并用白线缝合/缝合。这不是常见选项,因为横幅上可以看到线程。
现在在鼠标悬停的提示框中,上面给出的文本必须显示,因为它与段落一起显示在上面。但是当我将上面作为参数传递给该函数并附加一些反斜杠以识别一些标点时,iots直到给出我的未终止字符串的javascript错误...
我这样做:
onMouseover="showhint('Hemmed Finish\: Every side/edge \(1/2\'\' to 2\'\'\) of the banner are folded and glued \(special vinyl solution\) or heat pressed. This is the most common and best finish option.Stitched Finish\: Every side/edge \(1\'\' to 2\'\'\) of the banner are folded in the back and stitched/sewed with white thread. This is not a common option as thread can be seen on the banner', this, event, '250px')"
发布于 2018-09-25 13:43:58
好吧,我有个解决办法:
<element onMouseover="showhint('<p>Hemmed Finish: Every side/edge (1/2" to 2") of the banner is folded and glued (special vinyl solution) or heat pressed. This is the most common and best finish option.</p><p>Stitched Finish: Every side/edge (1" to 2") of the banner is folded in the back and stitched/sewed with white thread. This is not a common option as thread can be seen on the banner</p>', this, event, '250px')" />
发布于 2018-09-25 14:45:27
必须转义“字符。所以而不是”使用\“(反斜杠),可以使用新行字符来创建段落\ n或者如果你的工具提示能够显示html使用
https://stackoverflow.com/questions/-100000793
复制相似问题