I spent hours trying to figure out why even the simplest code won’t run on Internet Explorer. I always got the “Object doesn’t support this property or method” error. I’ve even tried both innerHTML and DOM, and still, IE isn’t happy. After those long hours, I found a simple fix that works.
I got more and more curious because I’ve written another page (4 chained drop down list) with xajax and it run flawlessly on either Firefox, Internet Explorer and Opera. Tired of looking my codes, I decide to try something simple on a separate page.
...
$objResponse->addScript("alert('a');");
...
But it still won’t work. Luckily (and why this idea doesn’t came in the first place), I use the Web Developer Toolbar on Firefox, where you could just click Infomation > View Javascript. Trying to found the line where IE mention the error. After removing some unused lines, i found the suspect.
Line 954: for (i=0; i<xml.childNodes.length; i++)
Uninitialized variable ‘i’. After simply changed the code to:
Line 954: for (var i=0; i<xml.childNodes.length; i++)
It’s now up and running, on IE too. Hope this post may help others with similar problem and save others time of digging for the bug. I’ve also sent this topic to the xajax Forums, you can discuss it there, too. Happy Coding!