假設我有三個圈 - 一個紅色,一個黃色和一個綠色。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