I have got a inline svg as a variable on my page. I'm doing some modifications to it. How can I echo viewText
on the page (not the svg image) with modifications. How can I make viewText
show on the page?
Example:
<script>
var viewText = "<svg width="400" height="100"><rect width="400" height="100" style="fill:rgb(0,0,255);stroke-width:10;stroke:rgb(0,0,0)" /></svg>"
var rect = document.getElementsByTagName("rect");
for (var i = 0; i < rect.length; i++) {
//do something
}
document.write( viewText );//how do I output the modified 'viewText' code on the page?
/*e.g.:
<svg width="400" height="100"><rect width="400" height="100" style="fill:rgb(0,0,255);stroke-width:10;stroke:rgb(0,0,0)" /></svg> */
</script>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…