2010-01-18, 05:01 PM
I have the following function that is supposed to load in a text file and display it in a div.
No problems so far but the text file also contains some html that I also want included but all I get is the text itself.
Basically I have a something like this..
The div, which gets its content from the function, is supposed to not only contain the text but the rest of the html table tags etc.
The text file may contain something like..
But all I get is
Some text hereSome more text here
It seems that the function is stripping out all html tags. Strangely enough it works fine in Opera but not in anything else
Any ideas anyone?
<script type="text/javascript">
function loadXMLDoc()
{
url='stest.txt';
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
document.getElementById('test').innerHTML=xmlhttp.responseText;
}
</script>
No problems so far but the text file also contains some html that I also want included but all I get is the text itself.
Basically I have a something like this..
<table>
<div id="test"></div>
</table>
The div, which gets its content from the function, is supposed to not only contain the text but the rest of the html table tags etc.
The text file may contain something like..
<tr><td>Some text here</td></tr>
<tr><td>Some more text here</td></tr>
But all I get is
Some text hereSome more text here
It seems that the function is stripping out all html tags. Strangely enough it works fine in Opera but not in anything else
Any ideas anyone?