将 SVG 路径存储为 JavaScript 变量
我似乎在将 SVG 路径字符串存储在简单的 javascript 变量中时遇到了一些问题。这对我来说有点神秘,我无法找到任何可以说明为什么会发生这种情况的信息。
该路径存储在单行字符串中,两端带有双引号。这是该文件中唯一的内容,但是当我尝试将字符串与 Raphael.js 一起使用时,我收到了异常错误。想法?非常感谢任何帮助。
I seem to be having a bit of an issue storing an SVG path string in a simple javascript variable. This is a bit mystifying to me and I haven't been able to find anything that points to why this might be happening.
The path is stored in a single-line string, with double quotes on each end. That's the only thing in this file, yet when I try to utilize the string with Raphael.js I'm getting that exception error. Thoughts? Any help greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 JavaScript 中,将字符串分布在多行中是不合法的,就像屏幕截图中显示的那样。您可以编辑代码,以便分配给
greenland
的字符串全部位于一行,或者在字符串中每行末尾添加反斜杠以转义换行符。It is not legal in JavaScript to spread a string across multiple lines like it appears to be in your screenshot. You might edit your code so that the string being assigned to
greenland
is all on one line or put a backslash to escape the newline character at the end of each line in the string.