Clicca sui 2 cerchi per rimuoverli.
JavaScript può eliminare un elemento tramite removeChild().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" width="640" height="480"> <script type="text/ecmascript"> <![CDATA[ function rimuoviElemento(evt) { var elemento=evt.target; elemento.parentNode.removeChild(elemento); } ]]> </script> <circle cx="150" cy="150" r="100" fill="blue" onclick="rimuoviElemento(evt)"/> <circle cx="400" cy="150" r="100" fill="red" onclick="rimuoviElemento(evt)"/> </svg> |