Connecting Tech Pros Worldwide Forums | Help | Site Map

createElementNS on IE...

Newbie
 
Join Date: Mar 2007
Posts: 4
#1: May 3 '07
Hi All

document.createElementNS works fine on firefox, but not on IE.

I use this fuction to create SVG objects on the fly

for example.....

SVG.ns = "http://www.w3.org/2000/svg";
var svg = document.createElementNS(SVG.ns, "svg:svg");

Some of the forums suggested to use document.createElement insteaad of document.createElementNS on IE......

But I want to create an elemnt from the name space which is present in "http://www.w3.org/2000/svg"


how do i do that in IE.

Thanks
Prasanna

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: May 3 '07

re: createElementNS on IE...


See this thread
Newbie
 
Join Date: Mar 2007
Posts: 4
#3: May 4 '07

re: createElementNS on IE...


Hi

I read the thread and it points to one more thread

http://simonwillison.net/2003/Jun/15/javascriptWithXML/

where it says replace all occurences of createElementNS with createElement.

But my if i say
document.createElement("svg:svg");
thing may not work, since svg:svg is present in the http://www.w3.org/2000/svg namespace, how do i specify that ?

Thanks
Prasanna
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: May 4 '07

re: createElementNS on IE...


Have you read the last comment on that page? IE doesn't understand name spaces because everything is rendered as HTML, not XHTML.
Newbie
 
Join Date: Mar 2007
Posts: 4
#5: May 7 '07

re: createElementNS on IE...


Quote:

Originally Posted by acoder

Have you read the last comment on that page? IE doesn't understand name spaces because everything is rendered as HTML, not XHTML.

Ya I agree!!!!!
But somthing like this may not work..

document.createElement("svg:svg");

Is there an alternative for this ?
Reply


Similar JavaScript / Ajax / DHTML bytes