Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Apr 2009
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Searching Text file with Javascript

    Im trying to use javascript to search a text file. text file is like this...


    1111111[TAB]Project Name[TAB]Application1
    2222222[TAB]Project Name[TAB]Application2


    Im trying to get the javascript to let a user search for number or project name, if found it displays all the info if found. application1 or application2 (whatever is in the 3rd area)
    The text file can also be seperated by commas, either way is fine.

    can anyone help with this. ?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Where is the text file?? It must come from the same domain for this to be possible.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Apr 2009
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes . same domain in the same directory as the web page.

    Also if nothing is found from the 2 search criteria, would be great for it to say a message "like nothing found. bla bla bla."

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Do I need to show the code to open and grab file contents? Using XMLHTTP? Or do you know all that?

    Back later. Meeting.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New Coder
    Join Date
    Apr 2009
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can you please show it all ?

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    http://www.mywhizbang.com/simplesearch.html

    Do a VIEW==>>SOURCE (or PAGE SOURCE) to see the code.

    The text file is http://www.mywhizbang.com/sampledata.txt

    Contents are this:
    Code:
    123	WASH-1	Wash the windows
    123	PLAY-1	Play with the dog
    456	WASH-2	Wash the car
    789	WASH-3	Wash the dog
    456	PLAY-2	Play with the kids
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    New Coder
    Join Date
    Apr 2009
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You are the friggin man. thank you.

    another couple questio
    I added a clear button which is clearing the text fields, but can i also make that same reset button clear the div tag text
    Last edited by vsantoro; 07-16-2010 at 05:26 PM.

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Code:
    <input type="reset" value="Reset" onclick="document.getElementById('RESULTS').innerHTML=' ';">
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #9
    New Coder
    Join Date
    Apr 2009
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you !!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •