简体   繁体   English

imacros-使用javascript读取文本文件

[英]imacros - read text file using javascript

I want to read text file using javascript not using imacros loop 我想使用JavaScript而不是使用imacros循环读取文本文件

I tried to read it using java with no luck 我试图用Java来阅读它没有运气

function frdln(n){ var fr,s=''; 函数frdln(n){var fr,s =''; try{ 尝试{

 fr=new java.io.BufferedReader(new java.io.FileReader(n)); s=fr.readLine(); if(s==null){s=''}else{s=''+s}; fr.close(); fr=null; }catch(e){ alert(''+e); }; return s; }; 

give me message error "ReferenceError: java is not defined" 给我消息错误“ ReferenceError:未定义Java”

Note:I installed latest version of java and the same error appear 注意:我安装了最新版本的Java,并出现了相同的错误

if there is any other way to read text file or fix my code because I have no idea 是否有其他方法可以读取文本文件或修复我的代码,因为我不知道

using javascript this can work XMLHttpRequest() but XMLHttpRequest() is no longer supported in firefox 15+ You must have to define it: 使用javascript可以工作XMLHttpRequest(),但是firefox 15+中不再支持XMLHttpRequest()。您必须定义它:

const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1"); const XMLHttpRequest = Components.Constructor(“ @ mozilla.org/xmlextras/xmlhttprequest;1”); var request = XMLHttpRequest(); var request = XMLHttpRequest();

Install FireFox 15 and don't update it and that function will work. 安装FireFox 15并不要更新它,该功能将起作用。 Java is not supported in FF16+ but in FF15 it works. FF16 +不支持Java,但在FF15中它可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM