javascript - Generated SVG image doesn't display -
I am developing JavaScript class to show all SVG objects, but when I create an element "image" , The browser does not display it, although I am copying the generated code and putting it in another document, the image is displayed.
When I search for an image using the firebug inspector, the object is visible but the image is not displayed.
By using appendChild ()
, setAttribute ()
and setAttributeNS ()
Object is created This is generated code:
What am I doing?
The problem was the namespace. This is the correct form for dynamically creating images:
image.setAttributeNS ('http://www.w3.org/1999/xlink', 'xlink: href', 'flower .png ');
Can be found on more shapes.
Comments
Post a Comment