Here am trying to open the file by selecting in listbox in html contains txt file names like hello.txt.
Path am giving like this "E:\\DragableExample\\Documents\\"+selected"
here vale of "selected" will be hello.txt
function savedload()
{
var doc = new ActiveXObject("Scripting.FileSystemObject");
var dpt = document.getElementById("sltrtcnty");
var selected= dpt.options[dpt.selectedIndex].value;
var txt = doc.OpenTextFile("E:\\DragableExample\\Documents\\"+selected,1,true);
alert(txt);
var row=txt.ReadAll();
document.all.mySaveModel.value = row;
var str = document.getElementById("mySavedModel").value;
myDiagram.model = go.Model.fromJson(document.all.mySavedModel.value );
myDiagram.model.undoManager.isEnabled = true;
doc.quit(0);
}
use jQuery.get() to Read Text File
jQuery.get('file.txt', function(data) {
alert(data);
//process text file line by line
$('#div').html(data.replace('n','<br />'));
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.