es131245 Posted October 26, 2011 Share Posted October 26, 2011 Im using AJAX to change divs innerHTML.FireFox after updating innerHTML 'understand' HTML in DIV but Chrome doent, it just shows HTML as text.Is the main idea is bad? Example function show(path){var content=document.getElementById('info');if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){content.innerHTML=xmlhttp.responseText;content.innerText=xmlhttp.responseText;}}xmlhttp.open('GET','/production/'+path+'.htm',true);xmlhttp.send();}<a href="#" onclick="show('podsvetka');"><img src="source/podsvetka.jpg" alt="подсветка"><br />подсветка</a><div id="info"><img id="loading" src="/source/loading.gif" alt="Loading..." /></div>пример podsvetka.htm<table><tr><td>Podsvetka</td> <td>$1</td> <td>Green/red/blue/white</td></tr></table> Link to comment Share on other sites More sharing options...
Ingolme Posted October 26, 2011 Share Posted October 26, 2011 This is the problem: content.innerText=xmlhttp.responseText;You're explicitly telling it to interpret it as text. Firefox doesn't understand the innerText property while Chrome does. Just delete that line. Link to comment Share on other sites More sharing options...
es131245 Posted October 26, 2011 Author Share Posted October 26, 2011 This is the problem: content.innerText=xmlhttp.responseText;You're explicitly telling it to interpret it as text. Firefox doesn't understand the innerText property while Chrome does. Just delete that line. But some operas doent understand innerHTML, they used innerText instead Link to comment Share on other sites More sharing options...
Ingolme Posted October 26, 2011 Share Posted October 26, 2011 No, all browsers use innerHTML. Link to comment Share on other sites More sharing options...
es131245 Posted October 26, 2011 Author Share Posted October 26, 2011 Thanks =) You are right!Every time =) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.