Clicca ripetutamente sui 2 cerchi per intervenire sul loro bordo.
JavaScript può rimuovere un attributo tramite removeAttribute(“…”).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" width="640" height="480"> <script type="text/ecmascript"> <![CDATA[ function rimuoviStroke(evt) { var elemento=evt.target; if(elemento.hasAttribute("stroke")) elemento.removeAttribute("stroke"); else alert("L'elemento non possiede l'attributo 'stroke'"); } ]]> </script> <circle cx="150" cy="150" r="100" stroke="black" stroke-width="3" fill="blue" onclick="rimuoviStroke(evt)"/> <circle cx="400" cy="150" r="100" stroke="blue" stroke-width="3" fill="red" onclick="rimuoviStroke(evt)"/> </svg> |