[HTML]html读取本地文件并显示

<html>
<body>
<script script type="text/javascript">
function show()
{
var reader = new FileReader();
reader.onload = function()
{
alert(this.result)
}
var f = document.getElementById("filePicker").files[0];
reader.readAsText(f);
}
</script>
<input type="file" name="file" id="filePicker"/>
<div id = "div1">
</div>
<input type="button" value = "显示" onclick="show()"/>
</body>
</html>
上一篇:网络编程:I/O复用


下一篇:vue组件如何被其他项目引用