ard*_*vis 28 svg comments block-comments
我正在尝试第一次学习SVG,但代码似乎与我的块注释有问题.我正在使用:
/* This is my
* block comment
*/
Run Code Online (Sandbox Code Playgroud)
当我运行我的代码时,我收到以下错误:
'return' statement outside of function
line: 116, column: 4
Run Code Online (Sandbox Code Playgroud)
这恰好发生在我的块评论之前.
Yur*_*riy 48
由于SVG是XML,因此您可以使用XML样式注释:
<!--
comment
-->
Run Code Online (Sandbox Code Playgroud)
例如:
<g onclick = "setScale(1)">
<rect id = "scale1" x = "120" y = "10" width = "30" height = "30"
fill = "#ffc" stroke = "black"/>
<!--
this text describes middle rectangle
-->
<text x = "135" y = "30" text-anchor = "middle">M</text>
</g>
Run Code Online (Sandbox Code Playgroud)
或者您可以排除部分代码:
<!--
this group is disabled for testing
<g onclick = "setScale(1)">
<rect id = "scale1" x = "120" y = "10" width = "30" height = "30"
fill = "#ffc" stroke = "black"/>
<text x = "135" y = "30" text-anchor = "middle">M</text>
</g>
-->
Run Code Online (Sandbox Code Playgroud)