1
<%
@ Page Language
=
"
C#
"
AutoEventWireup
=
"
true
"
CodeFile
=
"
Default.aspx.cs
"
Inherits
=
"
_Default
"
%>
2![](/Images/OutliningIndicators/None.gif)
3
<!
DOCTYPE html PUBLIC
"
-//W3C//DTD XHTML 1.0 Transitional//EN
"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
"
>
4![](/Images/OutliningIndicators/None.gif)
5
<
html xmlns
=
"
http://www.w3.org/1999/xhtml
"
>
6
<
head runat
=
"
server
"
>
7
<
title
>
XmlHttplObject对象学习第一天
</
title
>
8
<
script language
=
"
javascript
"
type
=
"
text/javascript
"
>
9
var xmlhttp;
10
11
//
创建XMLHttp对象
12
function CreateXmlHttpObject()
13![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
14
if(window.ActiveXObject)
15![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
16
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
17
}
18
else
19![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
20
if(window.XMLHttpRequest)
21![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
22
xmlhttp = new XMLHttpRequest();
23
}
24
}
25
}
26
27
function StartOperate()
28![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
29
CreateXmlHttpObject();
30
xmlhttp.onreadystatechange = Read;
31
xmlhttp.open("Get","XMLFile.xml",true);
32
xmlhttp.send();
33
}
34
function Read()
35![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
36
if(xmlhttp.readystate == 4)
37![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
38
if(xmlhttp.status == 200)
39![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
40
document.getElementById("div_Info").innerHTML = xmlhttp.ResponseText;
41
}
42
}
43
}
44
</
script
>
45
</
head
>
46
<
body
>
47
<
form id
=
"
form1
"
runat
=
"
server
"
>
48
这里没有开始异步调用
49
<
br
/>
50
<
br
/>
51
<
div id
=
"
div_Info
"
>
52
53
</
div
>
54
<
input type
=
"
button
"
id
=
"
button1
"
value
=
"
异步调用
"
onclick
=
"
StartOperate()
"
/>
55
</
form
>
56
</
body
>
57
</
html
>
58
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
14
![](/Images/OutliningIndicators/InBlock.gif)
15
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
18
![](/Images/OutliningIndicators/InBlock.gif)
19
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
24
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
25
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
26
![](/Images/OutliningIndicators/None.gif)
27
![](/Images/OutliningIndicators/None.gif)
28
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
29
![](/Images/OutliningIndicators/InBlock.gif)
30
![](/Images/OutliningIndicators/InBlock.gif)
31
![](/Images/OutliningIndicators/InBlock.gif)
32
![](/Images/OutliningIndicators/InBlock.gif)
33
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
34
![](/Images/OutliningIndicators/None.gif)
35
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
36
![](/Images/OutliningIndicators/InBlock.gif)
37
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
38
![](/Images/OutliningIndicators/InBlock.gif)
39
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
40
![](/Images/OutliningIndicators/InBlock.gif)
41
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
42
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
43
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
44
![](/Images/OutliningIndicators/None.gif)
45
![](/Images/OutliningIndicators/None.gif)
46
![](/Images/OutliningIndicators/None.gif)
47
![](/Images/OutliningIndicators/None.gif)
48
![](/Images/OutliningIndicators/None.gif)
49
![](/Images/OutliningIndicators/None.gif)
50
![](/Images/OutliningIndicators/None.gif)
51
![](/Images/OutliningIndicators/None.gif)
52
![](/Images/OutliningIndicators/None.gif)
53
![](/Images/OutliningIndicators/None.gif)
54
![](/Images/OutliningIndicators/None.gif)
55
![](/Images/OutliningIndicators/None.gif)
56
![](/Images/OutliningIndicators/None.gif)
57
![](/Images/OutliningIndicators/None.gif)
58
![](/Images/OutliningIndicators/None.gif)
把一个写xml文件中的内容写到 id为"div_Info"层里
达到了页面不需回发到服务器!