📄 default.aspx
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script>
function makerequest(t)
{
document.getElementById("test").innerHTML="正在刷新数据,请稍候.......";
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
http_request.onreadystatechange = dothing;
http_request.open('GET','aa.aspx', true);
http_request.send(null);
}
function dothing()
{
if (http_request.readyState == 4) {
// everything is good, the response is received
if (http_request.status == 200) {
// perfect!
document.getElementById("test").innerHTML=http_request.responseText;
} else {
// there was a problem with the request,
// for example the response may be a 404 (Not Found)
// or 500 (Internal Server Error) response codes
}
} else {
// still not ready
}
}
</script>
</head>
<body style="text-align: center">
<table style="width: 897px; height: 313px; border-right: #cccccc 1px solid; border-top: #cccccc 1px solid; border-left: #cccccc 1px solid; border-bottom: #cccccc 1px solid;">
<tr>
<td style="width: 100%; height: 80px; text-align: center">
本例显示一个局部刷新的过程,刷新的内容是服务器的时间具体应用中再作改变。</td>
</tr>
<tr>
<td style="width: 100%; height: 105px">
当你点击下面的刷新按钮时页面将去服务器上读取服务器上当前的时间并返回给本页面,在这个过程中本页面并不进行全面的更新,如现在服务器上的时间是:
<span id="test" style=" color:Red; font-size: 14pt;font-family: 隶书"> </span>你点一次刷新就读一次服务器时间数据传到这。
</td>
</tr>
<tr>
<td style="width: 100%; text-align: center">
<a onclick="makerequest('aa.txt');">刷新</a></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -