티스토리 뷰

728x90
반응형

http://www.gisdeveloper.co.kr/?p=5566

<!DOCTYPE html>

<html>

    <head>

        <title>HTML</title>

<script>

function openTextFile() {

    var input = document.createElement("input");

    input.type = "file";

    input.accept = "text/plain";

    input.onchange = function (event) {

        processFile(event.target.files\[0\]);

    };

    input.click();

}

function processFile(file) {

    var reader = new FileReader();

    reader.onload = function () {

        output.innerText = reader.result;

    };

    reader.readAsText(file, /\* optional \*/ "euc-kr");

}

</script>

    </head>

    <body>

        <h1>HTML</h1>

        <p>

<button onclick="openTextFile()">Open</button>

<div id='output'>...</div>

</p>

    </body>

</html>
728x90
반응형
댓글
글 보관함
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Total
Today
Yesterday