假设我有三个圈 - 一个红色,一个黄色和一个绿色。Javascript:如何将SVG图像放入数组中?
<svg height="100" width"100"=""> <circle cx="50" cy="50" r="40" stroke = "black" stroke-width = "3" fill="red "></circle> </svg>
<svg height="100" width"100"=""> <circle cx="50" cy="50" r="40" stroke = "black" stroke-width = "3" fill="yellow"></circle> </svg>
<svg height="100" width"100"=""> <circle cx="50" cy="50" r="40" stroke = "black" stroke-width = "3" fill="green"></circle> </svg>
是否有可能创建一个包含这3个数组的数组? 如果不是,你能推荐一种方法来创建一个包含三个红色,黄色和绿色圆圈的数组吗?
非常感谢
元素的语法被破坏('... width“100”=“”...')。 – collapsar
'var svgImages = document.querySelectorAll('svg');' –
当你说'你有3个圈子'时,你的意思是你有他们在一个HTML页面(内联),作为一些html/xml中的链接目标,或者在(JS)字符串中的文本? – collapsar