Help - Search - Members - Calendar
Full Version: Read Contents from a .txt into a webpage
MSFN Forums > Coding, Scripting and Servers > Web Development (HTML, Java, PHP, ASP, XML, etc.)

   
Google Internet Forums Unattended CD/DVD Guide
XicE
Hi Guys,
i have a wepage that all i want to do is put text over certain parts of it, without having to edit the html every time i open the page.

I want this text to be read from a text file (in same dir) .

What would be the simplest way???

Is it possible to use javascript, or flash or what

Thanks Guys
nateklomp
Hiya,

The easiest way to do this IMHO is with a javascript document.write in an external ".js" file. A ".js" file is called by a "<script src=yourscript.js>" and closed with "</script>" just like a normal script. The .js file itself is plain text and can be used to simply output text (or html) to be written dynamically to a page when used with the javascript document.write function.
You can find this script easily anywhere on the web.
A simple .js file to write some plain text to a page:
CODE
<!-- document.write("

Put your text, form, html-markup for image, links, etc.  in here, but no matched parentheses!  We do NOT want to close our script early...

") //-->


PLEASE don't use flash unneccessarily, some (the majority, possibly) of users are still on dialup...
YoussefGamil
Hi,
As I think the easies way is to create Inline Frame in the page!!
...
I have tested a lot of ActiveXobjects to read/write file in my localhost (I mean in the hard disk only).
But,..
I think there is a way in using JavaScript in this position (for that aim)
....
I will reply to this as soon as I find the answer
YoussefGamil
QUOTE (nateklomp @ Sep 7 2005, 04:02 AM)
Hiya,

The easiest way to do this IMHO is with a javascript document.write in an external ".js" file.  A ".js" file is called by a "<script src=yourscript.js>" and closed with "</script>" just like a normal script.  The .js file itself is plain text and can be used to simply output text (or html) to be written dynamically to a page when used with the javascript document.write function. 
You can find this script easily anywhere on the web.
A simple .js file to write some plain text to a page:
CODE
<!-- document.write("

Put your text, form, html-markup for image, links, etc.  in here, but no matched parentheses!  We do NOT want to close our script early...

") //-->


PLEASE don't use flash unneccessarily, some (the majority, possibly) of users are still on dialup...
*


Ohh,..yeah
BUT, this should only work with JS files (only)
XicE
Thanks guys
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.