在线申请打开txt文件
Make an online application to open txt file
这很牵强,但我知道它可以而且已经完成了。你知道如何在线 website/app 打开文件吗?基本上是一个可以读取和输出 HTML/TXT 文件的网站或应用程序。我最好使用 javascript 或 jquery,但任何适用于网站的语言都可以。有像 Text for Chrome
这样的在线应用程序可以做到这一点。你知不知道怎么?如果你能在这里帮助我,那就太好了。如果您有任何问题,请随时提出。
尝试利用 <input>
元素; <textarea>
元素; accept="text/plain"
属性位于 input
元素; onchange
事件附加到 input
元素; FileReader()
在 onchange
事件中将上传的文本文件输出到 <textarea>
元素
var input = document.getElementById("input");
var output = document.querySelector("[for=input]");
input.onchange = function(e) {
var reader = new FileReader();
reader.onload = function(evt) {
output.textContent = evt.target.result;
};
reader.readAsText(e.target.files[0]);
};
<input id="input" type="file" accept="text/plain" /><br />
<textarea for="input" style="width:300px;height:300px;"></textarea>
这很牵强,但我知道它可以而且已经完成了。你知道如何在线 website/app 打开文件吗?基本上是一个可以读取和输出 HTML/TXT 文件的网站或应用程序。我最好使用 javascript 或 jquery,但任何适用于网站的语言都可以。有像 Text for Chrome
这样的在线应用程序可以做到这一点。你知不知道怎么?如果你能在这里帮助我,那就太好了。如果您有任何问题,请随时提出。
尝试利用 <input>
元素; <textarea>
元素; accept="text/plain"
属性位于 input
元素; onchange
事件附加到 input
元素; FileReader()
在 onchange
事件中将上传的文本文件输出到 <textarea>
元素
var input = document.getElementById("input");
var output = document.querySelector("[for=input]");
input.onchange = function(e) {
var reader = new FileReader();
reader.onload = function(evt) {
output.textContent = evt.target.result;
};
reader.readAsText(e.target.files[0]);
};
<input id="input" type="file" accept="text/plain" /><br />
<textarea for="input" style="width:300px;height:300px;"></textarea>