Use AJAX technology to implement the Click button, the contents of the TXT text through the pop-up box displayed on the page
/* Events are triggered after the page load completes. * *
<script>
window.onload = function () {
/* get button id*/
var obth=document.getelementbyid (' btn ') ;
/* Click on the button trigger function *//
Obth.onclick = functions () {/
* Open Browser
/var xhr = new XMLHttpRequest ();
/* Enter the address in the Address bar, where the 1txt on behalf of the need to open a TXT file
/xhr.open (' Get ', ' 1.txt ', true)/
* Submit * *
xhr.send ();
/* Server return content
/* Xhr.onreadystatechange = function () {
if (xhr.readystate==4) {
alert (xhr.response Text)
;
}}} </script>
<body>
<input type= "button" value= "buttons" id= "btn" >
</body>
The above is the use of AJAX implementation through the pop-up window to open a text file.
Using AJAX technology to achieve TXT pop-up on the page is a small series to share all the content, I hope to give you a reference, but also hope that we support the cloud habitat community.