+ 4
Question regarding html #2.
How to toggle onmouseover in svg and how to set multiple value in the same option like radius fill stroke etc.
1 Answer
+ 5
What do you mean by "toggle onmouseover"? @@
And do you have always a question? As you seems know how to use events with svg attributes:
https://code.sololearn.com/WpvtPesM3I60/?ref=app
If your difficulty is to set many attributs for each event, simply separate the different JS instructions by the semi-coma (;) and a space (for readability :P):
onmouseover="evt.target.setAttribute('fill', 'red'); evt.target.setAttribute('r', '75');"
Obviously, this could become hard to read/write if you have a lot of JS to execute for an event listener... so a more clean solution (not already completly) is to define a function elsewhere (in a <script> section, inlined or linked) to be called in the event attribute:
onmouseover="myfunc2handleover(evt);"
And elsewhere:
<script>
function myfunc2handleover(e) {
e.target.setAttribute('fill', 'red');
e.target.setAttribute('r', '75');
/* any complex code call */
}
</script>
Anyway, the cleanest way to handle events (some are only accessible by this way) is to use the addEventListener() method to attach functions ^^