I want to know if it is possible to create a Drop-down list in HTML using Only a txt file? I have a list of places/countries, instead of creating for each, can i import it somehow from a txt file while each country is set in a single line? (i know how it's done using php, i just wonder if it could be done without it)
Asked
Active
Viewed 93 times
1 Answers
0
Using pure html? No. You will either need to use a preprocessor (sed,perl,etc) to generate the html page or a dynamic language to do it at run time - html is a static language.
You should be able to do it with javascript, but the only way I can think of involves making the txt file available on the web and using a XMLHttpRequest()
to get it. There is the new file api in html5, but that is aimed at local (to the client) files.

Oliver Matthews
- 7,497
- 3
- 33
- 36
-
THanks for the answer, can you give me a link containing JS code for this job? – Jihed Jaouabi Feb 10 '14 at 13:13
-
Not for that approach, but a little further digging says you can do it with iframes as well : http://stackoverflow.com/questions/4533018/how-to-read-a-text-file-from-server-using-javascript – Oliver Matthews Feb 10 '14 at 13:37