/    Sign up×
Community /Pin to ProfileBookmark

how to load .txt content into HTML table

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>

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@yashiharuauthorOct 09.2005 — no one have any idea?
Copy linkTweet thisAlerts:
@saulssOct 09.2005 — your code would work only on ie i think.

you can try using an iframe:
[code=html]<iframe src="LastUpdate.txt"></iframe>[/code]
Copy linkTweet thisAlerts:
@webstuffOct 09.2005 — 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.
Copy linkTweet thisAlerts:
@webstuffOct 09.2005 — BTW, the method I used required HTML tag to be present before any other tag in the document.
Copy linkTweet thisAlerts:
@yashiharuauthorOct 09.2005 — million thx to webstuff & saulss

finally, i found this

document.write(msg)

it works.

any compability problem?
×

Success!

Help @yashiharu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...