+ 3
Why javascript does not change svg width attribute to 300?
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <svg width="30" height="500"> <circle cy="60" cx="60" r="50" > </circle> </svg> <script> var el = document.getElementsByTagName("svg"); el[0].width ="300"; </script> </body> </html>
3 ответов
+ 5
try width = 300 + "px"
+ 4
How i can make moving (changing cx an cy)?
+ 2
(This may not work, this is only my idea on it. I apologize if this isn’t correct). The width is already assigned in <svg width=“30” height=“500”>. If you want to change it, just change the width in the SVG tag.