为了账号安全,请及时绑定邮箱和手机立即绑定

javascript 事件返回值的传递问题

javascript 事件返回值的传递问题

30秒到达战场 2019-03-22 15:14:12
javascript 事件返回值的传递问题
查看完整描述

2 回答

?
千巷猫影

TA贡献1829条经验 获得超7个赞


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

31

<html>

<head>

<script type="text/javascript">

function loadXMLDoc()

{

var xmlhttp;

if (window.XMLHttpRequest)

  {// code for   IE7+, Firefox, Chrome, Opera, Safari

  xmlhttp=new   XMLHttpRequest();

  }

else

  {// code for   IE6, IE5

  xmlhttp=new   ActiveXObject("Microsoft.XMLHTTP");

  }

xmlhttp.onreadystatechange=function()

  {

  if   (xmlhttp.readyState==4 && xmlhttp.status==200)

    {

    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;

    }

  }

xmlhttp.open("GET","/ajax/test1.txt",true);

xmlhttp.send();

}

</script>

</head>

<body>

<div id="myDiv"><h2>Let   AJAX change this text</h2></div>

<button type="button" onclick="loadXMLDoc()">通过 AJAX 改变内容</button>

</body>

</html>



查看完整回答
反对 回复 2019-03-26
  • 2 回答
  • 0 关注
  • 444 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信