0
我將一個SVG(Inkscape的圖片)在對象標籤這樣如何操縱長款從Inkscape中
<div class='rbis-svg-row'>
<div class='rbis-salta-svg'>
<object id='svg1' data='factory4-network-salta.svg' type='image/svg+xml' width='900px'>
</object>
</div>
</div>
那麼我可以訪問SVG元素與
<script>
document.getElementById("svg1").addEventListener("load", function() {
var doc = this.getSVGDocument();
var rect = doc.querySelector('#rectABC');
// Id for an object is rectABC
var theStyle = reg.getAttribute('style');
});
</script>
但!
風格是相當長的
"color:#000000;cliprule:nonzero;display:inline;overflow:visible;\
visibility:visible;opacity:0.58999999;isolation:auto;\
mix-blend mode:normal;colorinterpolation:sRGB;\
color-interpolationfilters:linearRGB;solid-color:#000000;\
solid-opacity:1;fill:#fcaf3e;fill-opacity:1;fill-rule:nonzero;\
stroke:#000000;stroke-width:3;stroke-linecap:round;\
stroke-linejoin:miter;stroke-miterlimit:4;\
stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;\
marker:none;color-rendering:auto;image-rendering:auto;\
shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
是否有改變的風格單財產什麼好辦法?或者我必須 提取字符串並操縱字符串?
/gh