有代码,但我仍然不知道如何在单击按钮时交换 SVG 元素。
<div class="container2">
<div class="pentagon2">
<svg width="250" height="250" viewBox="-1 0 101 100">
<path d="M20,0 L80,0 L100,60 L50,100 L0,60z" stroke="blue"/>
</svg>
<svg width="250" height="250" viewBox="-1 0 101 100">
<path d="M20,0 L80,0 L100,60 L50,100 L0,60z" stroke="red"/>
</svg>
<svg width="250" height="250" viewBox="-1 0 101 100">
<path d="M20,0 L80,0 L100,60 L50,100 L0,60z" stroke="green"/>
</svg>
<svg width="250" height="250" viewBox="-1 0 101 100">
<path d="M20,0 L80,0 L100,60 L50,100 L0,60z" stroke="black"/>
</svg>
<svg width="250" height="250" viewBox="-1 0 101 100">
<path d="M20,0 L80,0 L100,60 L50,100 L0,60z" stroke="yellow"/>
</svg>
<svg width="250" height="250" viewBox="-1 0 101 100">
<path d="M20,0 L80,0 L100,60 L50,100 L0,60z" stroke="orange "/>
</svg>
<svg width="250" height="250" viewBox="-1 0 101 100">
<path d="M20,0 L80,0 L100,60 L50,100 L0,60z" stroke="violet"/>
</svg>
<svg width="250" height="250" viewBox="-1 0 101 100">
<path d="M20,0 L80,0 L100,60 L50,100 L0,60z" stroke="blue"/>
</svg>
</div>
</div>
<button class="btn">Перемешать</button>
1 个回答