<svg width="100", height=100">
<polyline id="line" onclick="Click()" points="0,0 50,50" stroke-width="1" stroke="black"/>
</svg>
<script>
var line = document.getElementById('line');
line.style.points="0,50 0,0";
</script>
我希望使用 javascript 在页面中生成图像。由于某种原因,此代码无效。但是,如果最后一行是例如 line.style.stroke="green";
,它会起作用。为什么?