PDA

View Full Version : Reading flat or txt file and displaying as part of an HTML document



xtiano77
12-11-2008, 02:21 AM
I am trying to write an HTML page for my office and I would like to include a script that reads either a CSV or TXT file and displays the information based on what is typed inside a text box. Can anyone help me with that or at least point me in the right direction? Thanks in advance for your help.

diltony
12-16-2008, 10:44 PM
Reading CSV or Txt File is best done with server scripting language like php...
Anyway, i know one method with javascript when ur web browser is internet explorer:

<HTML XMLNS:MSIE >

<MSIE:DOWNLOAD ID="oDownload" STYLE="behavior:url(#default#download)" />

<SCRIPT>
function onDownloadDone(s) { alert (s); } //alert the file content
</SCRIPT>

<P>Click <A HREF="javascript:oDownload.startDownload('sample.txt',
onDownloadDone)">here</A> to download this page.