Is there a way to make a drop-down list that lists all of the textfiles in the same folder as my webpage is in? I only want the textfiles because I have other filetypes in there but while typing this, it makes me wonder if I can read the webpages own file while I am viewing it at the same time and what would happen if I edited it using it and then saved it. That would make it like alive! :o

I want to display the contents of a chosen selected textfile from the menu list into a resizable textarea but all I know is <input type="file"></input> which is inconvenient and all my searches for a javascript gave me jquery, ajax and php instead.

Do I have to install jquery, ajax and php for them to work on my computer? I'm not hosting this on a server, I'm just running it locally. Like from my own computer.

I have been searching for hours but the closest I can find just javascript is this which seems to need a URL, because I tried with document.getElementById("textarea").value = readfile('test.txt'); but maybe I'm just lacking knowledge and put it in the invalid location or I'm missing something?

You could do it with pure Javascript, but jQuery would probably make it easier (in my opinion that is).

For example, here is a jQuery script someone wrote to pull the list of files using an ajax call http://jqfaq.com/how-to-load-all-files-from-directory-using-jquery/

The same thing could be done with pure javascript, but why build a house with a hammer when you can use power tools?

I would recommend playing with it on a web server. Windows security does funny things sometimes. You can install WAMP or XAMPP on a windows server for a dev environment and it works just like an entire webserver to play around with. I would recommend hosting anything publicly on it though, it's more for dev.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.