Sunday, July 21, 2024
HomeCSSjavascript - The way to play svg animation on a web site?...

javascript – The way to play svg animation on a web site? TypeError: svgObject.beginElement isn’t a perform


I am newbie within the programming!Please assist me!!!I’ve the svg animation file and i need when i click on the button on my web site the svg will play.
Nevertheless it give me the difficulty:TypeError: svgObject.beginElement isn’t a perform.

right here is my code:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>svg</title>
</head>
<physique>
  <object sort="picture/svg+xml" id="svganimate" start="indefinite" knowledge="pattern.svg"></object>
  <button onclick="playAnimation()">Play Animation</button>
  
  <script>
    perform playAnimation() {
      var svgObject = doc.getElementById('svganimate');
      svgObject.beginElement();
    }
  </script>
</physique>
</html>

Can somebody assist me please!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments