现在的位置: 网页制作教程网站制作教程 >正文
jquery相关教程

jquery如何读取记事本TXT内容

发表于2017/5/5 网站制作教程 0条评论 ⁄ 热度 2,923℃

jquery如何读取记事本TXT的内容,可以采用jquery的ajax方式进行文件信息读取。

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
 $("#b01").click(function(){
  htmlobj=$.ajax({url:"test.txt",async:false});
  $("#myDiv").html(htmlobj.responseText);
 });
});
</script>
</head>
<body>
<div id="myDiv"><h2>通过 AJAX 改变文本</h2></div>
<button id="b01" type="button">改变内容</button>
</body>
</html>
  • 暂无评论