Since after some more examination it seems that parseXML() isn't going to
work at all, I need to know how to create some elements the DOM way. So
let's assume I need to create an element like this:

var newElement = document.createElement("rect");

That works fine and I can set attributes on it with the setAttribute()
function. But what happens when I need to set CSS attributes? This doesn't
work:

newElement.setAttribute("style", "visibility:hidden;");

And doing this:

newElement.style.setProperty("visibility", "hidden", null);

...tells me that I cannot call function "setProperty" of undefined,
basically meaning that newElement.style is undefined. Even this doesn't
work:

newElement.setAttribute("id", "newelement");
document.getRootElement().appendChild(newElement);
document.getElementById("newelement").style.setProperty("visibility",
"hidden", null);

Same error. What am I doing wrong, and how do I set a CSS property on a
newly created element?
-- 
View this message in context: 
http://www.nabble.com/How-to-set-CSS-values-on-newly-created-element-in-ECMAScript--tp14786784p14786784.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to