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

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -