javascript - SVG HTML Not Drawing SVG Pattern -
Creating an SVG pattern in HTML and changing the user color and size etc. But its not working I
I get an error about the load function on the body is. And then when I add the SVG placeholder to the SVG diagram then I have
Here's the script:
& lt; Script & gt; Var SVG = Document. GetElementById ("SVGIERIA"); Document.content.appendChild (SVG); Function drawCircle () {var svgLink = "http://www.w3.org/2000/svg"; Var center = document. CreateElementNS (svgLink, "circle"); Center.setAttributeNodeNS (zero, "id", "center"); Center.setAttributeNodeNS (zero, "cx", 230); Center.setAttributeNodeNS (zero, "cy", 0); Center.setAttributeNodeNS (zero, "r", 75); Center.setAttributeNodeNS (zero, "filling", "centreColour"); Document.getElementById ("svgArea") appendChild (center). Var group = document.getElementById ("svgArea"); group.setAttribute ("translate" "translation (230,0)"); } & Lt; / Script & gt; Then I have the following for body tags:
And for the content of the page I have the following code:
& Lt; / Svg & gt; & Lt; / Div & gt; Error: 'Undefined' is not an object (evaluation of 'document.content.appendChild') Global Code (< SVG. Html, line 33) [Error] Typematic error: DOM exception 17: The type of an object was incompatible with the expected type of parameter associated with the object.
> It does not work:
// for drawing petals (var i = 0; i & lt; number of petals; i ++) {var svgLink = "http: // www .w3.org / 2000 / svg "; Var flowerpot = document.createElementNS (svgLink, "oval"); FlowerPettle.setAttributeNS (zero, "id", "flowerpettle"); Flowerpot. Setitienna (empty, "ri", 230); Flowerpot. Set Attennis (empty, "Rx", 0) Flowerspotals. Setitienna (empty, "fill", petal color); Var rotate = "rotate (" + (i * (360 / number of petal) + "+ +", "+ 30 +"); flowerPettle.setAttribute ("transform", rotate); document.getElementById ("FlowerArea") appendChild (flowerPettle).}
Some things in your code are incorrect There is a createAttributeNode () call is the second document.content reference. Apart from this, there are things like "centrecllor" in the color of a strange color. I A working child is put together and hopefully it helps you to work in your code.
Comments
Post a Comment