<embed id="bottom" src="img/model/skirt.svg" onclick="control.colorClothes(this)" title="bottom" type="image/svg+xml" width="325" height="500"> </embed>
I want to cause an event to fire on a mouse click.
The above works if I use onload
and onmouseover
, but not onclick
or onmouseup
/down.
Any thoughts?
** Edit **
My thanks to the posters. The code I was looking for is
onload="this.getSVGDocument().onclick = function(event){alert(333);};"
It overcomes three separate problems.
The delay in loading the svg file causing issues with code trying to execute on an svg file that didn't exist yet.
That the
onclick
event has to be attached to the svg element. I'm not sure why, Tanzeels post showed this & my experiments confirmed it.The way I was trying to write the
onclick="alert(333)"
wasn't working. The above does. Again I'm not sure why, but at this point I'm just happy to go with the flow.