js读取本地TXT文件并且获取到内容

	var fso = new ActiveXObject("Scripting.FileSystemObject");
			var s = "";
			if (fso.FileExists("D://360MoveData/Users/lxn/Desktop/flbmxml.txt"))
				s += "exists";
			else
				s += "doesn't exist";
			if (s == 'exists') {
				var f = fso.OpenTextFile("D://360MoveData/Users/lxn/Desktop/flbmxml.txt");
				var str = "";
				while (!f.AtEndOfStream) {
					console.log();
					var temp = f.ReadLine(); //读取一行数据并按空格分割
					str += temp;	
				}
				pdf_url = str;
			}
			console.log(pdf_url);

使用activeX控件读取

 

你可能感兴趣的:(JavaWeb,javaScript)