Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Document.write from a text file

Status
Not open for further replies.
May 21, 2002
19
0
0
US
I need to know how to do a document.write from a text file and lineno basically pulling the information from the text file. I'm not real sure of the syntax to accomplish this. I'm thinking something like this:

document.write('somefile.txt lineno(1)')

Any ideas?

Eventually I will want to pull an entire array over and plug into my script.

Ron

 
Client-side Javascript can't read from text files on the server, and can't open any files on the client's side, except through an exploit/bug in early versions of IE 6.0 that has been patched.
 
Hmmm, ok! I'll have to think about this. I'm sure there must be another way to accomplish this? What I have is a slideshow that automatically sequences thru the pictures onto the page from another directory and I wanted to include a text discription for each picture. I know that I can put an array in the script but then that defeats my purpose. Currently the slideshow has 240+ pictures (digital cameras are wonderful). There must be a way to load an array from another file when the script runs. Or can one combine server side Java and JavaScript?
 
I know this is last resort, but can't you modify the pic's with some text to save server time and coding time possibly provide tools to let people become their best.
 
Last resort maybe, but I'm sure it can be done. It will just take some creativity and digging to find a solution.
 
possibility!
create in the directory a pic of the text you want shown for each and sequence thru them as accordingly to the other pic's with them formatted under them.

just a idea that may same some time seeing as you are already doing that. Would have to create 240+ pic though provide tools to let people become their best.
 
Unless someone has a high speed connection, it'll take quite a while to load the 240 graphic images, and the slide show won't look the way you want it to, or the way you saw it on your computer.

Java itself can load a text file and display lines from it, as well as graphics, but the big problem with the idea you have here is the time it'll take loading all those photos.
 
Your "solution" switches photos when each one is half loaded or less with my connection. That means that the main feature visiting your site is the clicking sound as one half (or less) loaded photo is changed to load another one halfway (or less). I saw some tops of trees, tops of heads, and tops of buildings, and various other things I couldn't distinguish, but nothing else came through (and nothing else demanding bandwidth in my connection). This is what I was referring to with the time it takes to load pictures on a slower connection.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top