this question has answer here:
is there way in html, (or know of quick javascript can link this?)
<body> <h1> static text </h1> <p> <include href="snippets/dynamic.txt" /> </p> </body> which render text inside of "dynamic.txt" part of webpage (client side) since static site no server side scripting engine.
you can following function in here javascript - read local text file , hope can
this code in that
function readtextfile(file) { var rawfile = new xmlhttprequest(); rawfile.open("get", file, false); rawfile.onreadystatechange = function () { if(rawfile.readystate === 4) { if(rawfile.status === 200 || rawfile.status == 0) { var alltext = rawfile.responsetext; alert(alltext); } } } rawfile.send(null); } and specify file:// in filename:
readtextfile("file:///c:/your/path/to/file.txt");
Comments
Post a Comment