Reputation: 139
As a development from my previous task, I now want to alter my SVG shapes using Java Script buttons using the 'onclick' procedure.
I have tried using it this way:
<input id="button1" type="button" value="Rotate Inner Short Arrows 45*"onclick="rotatex()"/>
<script>
function rotatex() {
document.getElementById("inner-arrow").setRotate(45,NativeCenterX,NativeCenterY)}
</script>
but every time I click the button nothing happens
I am a beginner in this language so would appreciate all the help I could get.
Thanks
Upvotes: 0
Views: 111
Reputation: 3488
Try the following:
function rotatex() {
document.getElementById("inner-arrow").setAttribute("transform","rotate(45 "+NativeCenterX+" "+NativeCenterY+")")
Upvotes: 1