search a .txt file and return results in HTML

If i have 2 text boxes and a button and a text file... How do I use the text entered in the first text box to search the .txt file and return the results into the second text box?  

Can I do this WITHOUT asp ?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can you do it without asp sure, but yu are going to have to have some kind of scripting language on the server.  An HTML page cannot access files.  You have to have some kind of search script.

Do you want to find the file on the server or on the client???
If the file is not very big in size you can get if from the server when the page is being loaded, then you can make a javascript function that can search for the Text in the file without making a server call.

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

TanyaGAuthor Commented:

What I would like to do is some sort of javascript function for the search button, like OnClick .. but can anyone supply some sort of code.. And can I use SQL in there or something? Like.. OnClick take the text from textbox1 and search .txt file for works LIKE the textbox1 and display in textbox2 (the entire string..)

TanyaGAuthor Commented:
BTW, this is just 1 text file and 1 html file. The text file contains a bunch of different books...
TanyaGAuthor Commented:
Is this valid?

SELECT ALL from books.txt ?
1. You need to use a database to do the SELECT ALL query. query.txt is just a text file.

2. I don't know if you can connect from a client (like javascript), all the way to your server which has the text file. It would be much easier if you can set up something like php or asp to read the text file and return the results.

Abhishek (AJ) Ratani
TanyaGAuthor Commented:
Do you know of any BASIC asp tutorials or examples I can look at?  I really don't know how to program in asp..
PHP is the easiest to install and use and its free and there are so many tutorials available,

i ask my question again Do you want to find the file on the server or on the client???

Also how is IIS hard to install you put your window cd into the computer, you dont even need to use the internet.
Yes, use JavaScript to load a text file from the same server as the HTML file is on.

var req;

function loadXMLDoc(url) {
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;"GET", url, true);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
  "GET", url, true);


// handle onreadystatechange event of req object
function processReqChange() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
         } else {
            alert("There was a problem retrieving the XML data:\n" +

function processtext()
   .... do whatever...

document.onload = loadXMLDoc("DVDs.txt");

XMLHttpRequest is cool.  It is what Google uses to make Gmail so quick and responsive.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.