?? 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 + -