Click to See Complete Forum and Search --> : how to load .txt content into HTML table


yashiharu
10-08-2005, 01:23 AM
i want to update the "last update" in every .html pages by loading the date from a txt file.

possible with javascript?
i've search around for it, and got the following script.

how can the content be display in the table (not a form)?
that is showing the variable in the table, like palain text.

thanks

<SCRIPT language = "Javascript">

objXml = new ActiveXObject("Microsoft.XMLHTTP");

// objXml = new ActiveXObject("Msxml2.XMLHTTP"); older version
var datafile = "LastUpdate.txt";

objXml.open("GET", datafile, true);
objXml.onreadystatechange=function() {
if (objXml.readyState==4) {
display(objXml.responseText);
}
}

objXml.send(null);

function display(msg) {
alert (msg);
}

</SCRIPT>

yashiharu
10-08-2005, 09:45 PM
no one have any idea?

saulss
10-09-2005, 01:31 AM
your code would work only on ie i think.
you can try using an iframe:
<iframe src="LastUpdate.txt"></iframe>

webstuff
10-09-2005, 08:52 AM
if you dig deep enough you will find a method that allows you to load up a txt file from the same domain as the calling page, I used some code that did what your asking, unfortunately IM not on the net and have limited internet access at my girlfriends, but a method exists that will allow you to do just that, if I can dig up the code, I will post it.

webstuff
10-09-2005, 08:54 AM
BTW, the method I used required HTML tag to be present before any other tag in the document.

yashiharu
10-09-2005, 09:06 AM
million thx to webstuff & saulss

finally, i found this
document.write(msg)

it works.

any compability problem?