innerHTML in InternetExplorer not working as expected
John Robert
Ranch Hand
Joined: Jun 17, 2008
Posts: 39
posted
0
Hello Ranchers, I am having difficulty understanding how innerHTML function works in Internet Explorer.
I have a jsp where on click, calls a ajax function and the textresponse of the ajax is set
back to the block using inner HTML.
Here is a part of my jsp
Note:I had to use 'onClik' instead of the actual 'onClick' because while posting I had some error.
This code works fine(both makelist and clearlist) in both IE and Mozilla Fire Fox.
However if i change the temp variable in javasript to 'display2' or 'display3'(as you can
see these are the ids of the table and tbody tags respectively), it does not work in IE but
works perfectly fine in firefox. So is it that innerHTML can only be appplied to div tags in
IE and not to any other tags? I read on googling that there is some bug in IE about
innerHTML, is this the one? I am using IE 7.0. Am I missing something here?? Any response would be appreciated. [ October 19, 2008: Message edited by: John Robert ]
Originally Posted by Bear Bibeault Are you trying to inject valid HTML into the table?
Thanks for the response. Yes I am trying to inject HTML something like this from the xmlhttp.responseText into the page.
I even tried just injecting the rows something like this, as the element is already a table or table body(when i set the temp variable to 'display2' or 'display3'
I am just trying to think how the innerHTML works, shouldnt it be able to put/clear Html on any block which has a start and end tag? May be i will use the div tag for now, it seems more stable and works as expected. But just wanted to know did any one face the same issue, or is it not working because I am doing something wrong. Well I think I am doing it right because it works in Fireforx perfectly.
Well it wouldn't be the first time someone's found a browser problem doing a particular task -- especially with tables (which can be finicky) and I believe that IE has particular problems with innerHTML and some types of elements. I don't have a Windows instance at my disposal so I can't try to recreate your issue. [ October 19, 2008: Message edited by: Bear Bibeault ]
Aha! Eric snuck in his post while I was typing -- confirms my suspicion about IE and innerHTML and tables.
John Robert
Ranch Hand
Joined: Jun 17, 2008
Posts: 39
posted
0
That answers why it wasnt working on IE. I also found out that this problem has been there for a while..i hope they fix it in the future. Appreciate all the help..
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: innerHTML in InternetExplorer not working as expected