首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何解决未终止字符串的JavaScript错误?

如何解决未终止字符串的JavaScript错误?
EN

Stack Overflow用户
提问于 2018-09-25 05:20:55
回答 2查看 0关注 0票数 0

想传递一个javascript functiona的参数,这是一个字符串。这个javascript函数是鼠标悬停的一个提示框..

我正在使用的字符串是这样的:

Hemmed Finish:横幅的每个边/边(1/2“到2”)都折叠并粘合(特殊的乙烯基溶液)或热压。这是最常见和最好的完成选项。 缝合完成:横幅的每个边/边(1“到2”)在后面折叠并用白线缝合/缝合。这不是常见选项,因为横幅上可以看到线程。

现在在鼠标悬停的提示框中,上面给出的文本必须显示,因为它与段落一起显示在上面。但是当我将上面作为参数传递给该函数并附加一些反斜杠以识别一些标点时,iots直到给出我的未终止字符串的javascript错误...

我这样做:

代码语言: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')"
EN

回答 2

Stack Overflow用户

发布于 2018-09-25 13:43:58

好吧,我有个解决办法:

代码语言:txt
复制
<element onMouseover="showhint('&lt;p&gt;Hemmed Finish: Every side/edge (1/2&quot; to 2&quot;) of the banner is folded and glued (special vinyl solution) or heat pressed. This is the most common and best finish option.&lt;/p&gt;&lt;p&gt;Stitched Finish: Every side/edge (1&quot; to 2&quot;) 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&lt;/p&gt;', this, event, '250px')" />
票数 0
EN

Stack Overflow用户

发布于 2018-09-25 14:45:27

必须转义“字符。所以而不是”使用\“(反斜杠),可以使用新行字符来创建段落\ n或者如果你的工具提示能够显示html使用

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100000793

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档