编辑您的代码:提交代码

x
 
1
 
2
 
3
<html>
4
<head>
5
<script type="text/javascript">
6
var xmlhttp
7
8
function loadXMLDoc(url)
9
{
10
xmlhttp=null
11
// code for Mozilla, etc.
12
if (window.XMLHttpRequest)
13
  {
14
  xmlhttp=new XMLHttpRequest()
15
  }
16
// code for IE
17
else if (window.ActiveXObject)
18
  {
19
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
20
  }
21
if (xmlhttp!=null)
22
  {
23
  xmlhttp.onreadystatechange=state_Change
24
  xmlhttp.open("GET",url,true)
25
  xmlhttp.send(null)
26
  }
27
else
28
  {
29
  alert("Your browser does not support XMLHTTP.")
30
  }
31
}
32
33
function state_Change()
34
{
35
// if xmlhttp shows "loaded"
36
if (xmlhttp.readyState==4)
37
  {
38
  // if "OK"
39
  if (xmlhttp.status==200)
40
  {
41
  document.getElementById('T1').innerHTML=xmlhttp.getAllResponseHeaders()
42
  }
43
  else
44
  {
45
  alert("Problem retrieving data:" + xmlhttp.statusText)
46
  }
47
  }
48
}
49
50
</script>
51
</head>
52
53
<body onload="loadXMLDoc('/example/xmle/xmle_test_xmlhttp.txt')">
54
<p>
55
With a HEAD request, a server will return the headers of a resource (not the resource itself). This means you can find out the Content-Type or Last-Modified of a document, without downloading it itself.
56
</p>
57
<div id="T1" style="border:1px solid black;height:100;width:300"></div>
58
</body>
59
60
</html>
61
            

查看结果:

请在上面的文本框中编辑您的代码,然后单击提交按钮测试结果。w3c0.com

W3c0.com 提供的内容仅用于培训。我们不保证内容的正确性。通过使用本站内容随之而来的风险与本站无关。W3c0 简体中文版的所有内容仅供测试,对任何法律问题及风险不承担任何责任。 当使用本站时,代表您已接受了本站的使用条款和隐私条款。版权所有,保留一切权利。 鲁ICP备15022115号