不需要服务器
直接静态网页显示
自动加载
iframe
自适应
<!DOCTYPE html>
<html>
<head>
<script>
function adjustIframe(){
var ifm= document.getElementById("bi_iframe");
// ifm.height=document.documentElement.clientHeight;
// ifm.width=document.documentElement.clientWidth;
ifm.height=500;
ifm.width=1000;
}
</script>
</head>
<body>
<!-- <iframe src="1.txt"></iframe> -->
<iframe id="bi_iframe" src="1.txt" onload="adjustIframe();"
frameborder="0" scrolling="auto">
</iframe>
<div>
<img src="./123.jpg" alt="">
</div>
</body>
</html>
手动加载
input type="file"
FileReader()
<!DOCTYPE html>
<html>
<body>
<input type="file" id="fileinput" onchange="loadFile(event)">
<pre id="filecontent"></pre>
<script>
function loadFile(event) {
var input = event.target;
var reader = new FileReader();
reader.onload = function(){
var text = reader.result;
var output = document.getElementById('filecontent');
output.innerText = text;
};
reader.readAsText(input.files[0]);
}
</script>
</body>
</html>