Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - appendChild & cloneNode [Thread Next] Re: appendChild & cloneNodeTo: NULL Date: 6/1/2009 2:50:00 PM On Jun 1, 5:35=A0pm, Chameleon <cham_...@hotmail.com> wrote:
> The following code display a DIV#help with AJAX loaded XML inside.
> It works fine in W3C Compliant Browsers but not in IE8.
> The problem in IE8 appears in last line.
> Is there an error in my code or an IE8 incompatibility?
> Any workarounds?
> Thanks
> ---------------------------------------------------------
> function openHelp(a) {
> =A0 =A0 =A0 =A0 var obj =3D document.getElementById('help');
> =A0 =A0 =A0 =A0 obj.style.display =3D 'block';
>
> =A0 =A0 =A0 =A0 var xmlHttp =3D new XMLHttpRequest();
> =A0 =A0 =A0 =A0 xmlHttp.onreadystatechange =3D function() {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (xmlHttp.readyState =3D=3D 4)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 innerDOM(obj, xmlHttp.res=
ponseXML.documentElement);
> =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 xmlHttp.open("GET", 'help.php/' + a, true);
> =A0 =A0 =A0 =A0 xmlHttp.send(null);
>
> }
>
> function innerDOM(where, root) {
> =A0 =A0 =A0 =A0 for (var z =3D 0; z < root.childNodes.length; z++)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 where.appendChild(root.childNodes[z].clon=
eNode(true)); =A0// <-- HERE IS
> THE PROBLEM}
>
> --------------------------------------------------------------
It takes a lot more than that to import XML nodes into an HTML DOM.
It is especially tricky in IE. I suggest you use innerHTML or find
another approach (e.g. download data instead of markup.)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
