View Full Version : Searching and Writing a text file

05-25-2005, 01:00 PM
Is there anyway in which i can search a .txt file and write the data to a web page using html or javascript at all? if so could somebody please help.

05-25-2005, 03:36 PM
I just read an article that gave some good workarounds tho, if you are wanting to read text then put it into a javascript file... ".js" and link it to the page, then make functions to pull it out....what is the main purpose of reading...now writing....that may be a different story. The articles I read were from this web page http://www.irt.org/script/file.htm it basically mentions that javascript is a "client side" program, so anything you do with a text field will be done on the user's computer and will act more like a cookie...but if you are interested just attach apache and learn php...or per...it will do that in a jiffy.


05-25-2005, 04:39 PM
cheers for that. SO your saying there is no way without using php or perl to read and present data from a text file? okies cheersa anyway

05-25-2005, 04:55 PM
I have not heard of a way of doing this, good question!

really easy to whip up in ASP!

:confused: so i have no answer then, sorry

05-25-2005, 05:35 PM
Javascript has many purposes but since you are doing client side programming when u use js it really cant help you on the server side, thats why they have made server side languages...but you can use ssi (Server Side Includes) if you are having issues with other languages...These can be done with most server side languages...but they are more for headers and footers, but with vbscript you can mess around with the included text, I really havent given it much thought because of the dynamics you get when you use a server side language you really dont need to read from a text file in javascript...I guess thats all...sorry to disappoint you...what were you looking to do with it tho???

05-25-2005, 06:33 PM
How big is the text file?

If it is not too large then what you could do instead is to load this text into the page in a hidden area, say
<div id=hiddentext" style="display: none">
Then, search this div and print the results where you need them.

If the text makes the page too large, then this solution is too slow to be useful.