views:

188

answers:

3

Hi,

I thought what I was trying to do is quite simple, but apparently nothing related to IE is ever simple.

I'm using this with javascript and ajax - document.getElementById("calender").innerText=mypostrequest.responseText

it works fine in ff and IE7, but not IE8. I suspect it's because the text contains a table, since I have tested it with other text. I cant replace the table. Is there any way to get around this?

A: 

Try

document.getElementById("calender").innerHTML=mypostrequest.responseText
Salil
Sorry meant to say that earlier. Tried it as well and doesn't work.
lolla
A: 

ok switched to jquery ( $('#calender').html(mypostrequest.responseText) ) it works now

lolla
A: 

Hi,

I also have the same problem when setting innerHTML property with content which contain a table - the table does not display. I also try using jquery but doesn't work. Below is my simple test script.

I have two files, one is html and one is .htc file.

<!-- here is myTest.html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<HTML xmlns:myns>
<HEAD>
<?import namespace="myns" implementation="myHtc.htc">
</HEAD>

<BODY>
<DIV>
  This text is in the primary document.
  <BR>
  <!-- this is a custom element -->
  <myns:abc id="srch"></myns:abc>
</DIV>

</BODY>
</HTML>

<!-- here is myHtc.htc -->
<public:component tagName="abc">
<attach event="oncontentready" onevent=init() />
</public:component>
<script> 
function init(){
defaults.viewLink=document;

}

function btnInner_onClick(){

  var strHTML = "<table><tbody><tr><td>Hello table text</td></tr></tbody></table>";
  testDisplay.style.display = 'block';
  testDisplay.innerHTML = strHTML ;


}

</script>
<HTML>

<BODY style="background-color: #FAF6F2;">
<DIV id="testDisplay" style="display: none; border: black solid 1px; background-color:white;" >Hello text</DIV>
<INPUT id=btnInner type=button value="Test Inner property" onclick="btnInner_onClick()"></INPUT>
</BODY>
</HTML>

Any help is appreciated, Thanks

Ben