Use ajax technology to implement the txt pop-up method on the page, ajaxtxt
Click the button Using ajax to display the content in the TXT text to the page through the pop-up box.
/* The event is triggered after the page is loaded. */<Script> window. onload = function () {/* Get button id */var oBth = document. getElementById ('btn ');/* click the function triggered by the button * // oBth. onclick = function () {/* Open the browser */var xhr = new XMLHttpRequest ();/* enter the address in the address bar, here, 1txt indicates the internal txt file to be opened */xhr.open('get', '1.txt ', true)/* submit */xhr. send ();/* and other content returned by the server */xhr. onreadystatechange = function () {if (xhr. readystate = 4) {alert (xhr. responseText) ;}}}</script> <body> <input type = "button" value = "button" id = "btn"> </body>
The preceding Code uses ajax to open a text file through a pop-up window.
The method to use ajax technology to implement txt pop-up on the page is to share all the content with you through the small Editor. I hope you can give us a reference and support the house of helping customers.