📄 default.aspx
字号:
<%@ Page language="c#" AutoEventWireup="false" Inherits="AJAXDemo.Examples.Special._default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Ajax.NET - HtmlControl Example</title>
<link rel="stylesheet" type="text/css" href="../../css/main.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<form id="Form1" method="post" runat="server"></form>
<div class="content">
<h1>Special Examples</h1>
<h2>Periodical Calls to the Server</h2>
<p>This example will invoke a Ajax.NET method every second to see the memory and cpu usage of the browser (JavaScript). Click <a href="javascript:doTest1();void(0);">here</a> to start the periodical calls.</p>
<p>The method will return the current date on the web server, will displayed here: <span id="doTest1_display">-----</span></p>
<h2>Session State Usage</h2>
<p>Click <a href="javascript:doTest2();void(0);">here</a> to set the date to your session variables, press F5 to reload the page and click <a href="javascript:doTest3();void(0);">here</a> to get the value back.</p>
<h2>Caching</h2>
<p>Click <a href="javascript:doTest4(1);void(0);">here</a> to get the server-side cached object (10 seconds).</p>
<p>If we modify the argument we will get a different cache, click <a href="javascript:doTest4(2);void(0);">here</a> to invoke the same method with a different argument.</p>
</div>
<p class="footer">Last updated: November 2, 2005 by <a href="http://weblogs.asp.net/mschwarz/contact.aspx" target="_blank">Michael Schwarz</a></p>
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a></p>
<script type="text/javascript" defer="defer">
function doTest1() {
AJAXDemo.Examples.Special.Demo.GetServerTime(doTest1_callback);
}
function doTest1_callback(res) {
var d = document.getElementById("doTest1_display");
if(d.innerText)
d.innerText = res.value.toString() + " " + res.value.getTime().toString();
else
d.textContent = res.value.toString() + " " + res.value.getTime().toString();
d = null;
setTimeout(doTest1, 250);
}
function doTest2() {
AJAXDemo.Examples.Special.Demo.SetSession(new Date(), doTest2_callback);
}
function doTest2_callback(res) {
}
function doTest3() {
AJAXDemo.Examples.Special.Demo.GetSession(doTest3_callback);
}
function doTest3_callback(res) {
alert(res.value);
}
function doTest4(i) {
AJAXDemo.Examples.Special.Demo.GetCachedServerTime(i, doTest4_callback);
}
function doTest4_callback(res) {
alert(res.value);
}
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -