read and display text file value in text box using Javasacript
<div id="page-wrapper"> <input type="text" id="allText"> </div> <script> var allText = document.getElementById('allText'); function readTextFile(file) { var rawFile = new XMLHttpRequest(); rawFile.open("GET", file, false); rawFile.onreadystatechange = function () { if (rawFile.readyState === 4) { if (rawFile.status === 200 || rawFile.status == 0) { var allText = rawFile.responseText; alert(allText); } } } rawFile.send(null); } readTextFile("file:///C:/MACID.txt"); </script>
Quote:JavaScript readTextFile("file:///C:/MACID.txt");
readTextFile("file:///C:/MACID.txt");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)