Forum Moderators: open

Message Too Old, No Replies

IE and InnerHTML

         

Steve Simpson

7:44 am on May 7, 2009 (gmt 0)

10+ Year Member



Hi,

I've seen another post about this problem but my problem seems alot different!

I've got report that allows me to drill down on the data by using <div> to hide/show the underlying data. The detail on the report is built using AJAX (calling a PHP script to generate the HTML to return).

I can run the page successfully using Firefox and I've checked that I've got all the matching DIV and /DIV, etc and everything looks ok.

I then run the same page on IE6 and IE8 and get a "Unknown runtime error" stating that there is a problem with the innerHTML line in the javascript;

// add html to place holder element (note: we are adding the html before we execute the scripts)
document.getElementById(id).innerHTML = orphNode.innerHTML;

I have other AJAX routines using the same code working but on the drill down report I can't get it to work.....If you need more examples of the code then let me know.

Thanks

Steve

DrDoc

7:45 am on May 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!

What do you get if you run this:
alert(document.getElementById(id));
alert(orphNode);

Steve Simpson

7:53 am on May 7, 2009 (gmt 0)

10+ Year Member



It displays [Object] for both alerts....

I tried;
alert(orphNode.innerHTML);
alert(document.getElementById(id).innerHTML);

first one displays the HTML that should be output so it proves that it's getting returned correctly.

The second one displays a blank window as there's nothing in the innerHTML property at the moment....

The contents of "id" are "order_item_list0" and it's defined as a <DIV>

[edited by: Steve_Simpson at 7:57 am (utc) on May 7, 2009]

Steve Simpson

8:31 am on May 7, 2009 (gmt 0)

10+ Year Member



I've sorted the problem now.....I've put a <TD> ....</TD> around the <DIV> and now it works

This article helped me...<snipped>

[edited by: whoisgregg at 10:45 pm (utc) on May 7, 2009]
[edit reason] Whoops, no URLs please. See TOS [webmasterworld.com] [/edit]

whoisgregg

10:48 pm on May 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, Steve!

Glad you got it sorted. :)