📄 keypress.aspx
字号:
<%@ Page language="c#" ClassName="KeyPressDemo" Inherits="System.Web.UI.Page" %>
<script runat="server" language="c#">
private void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(KeyPressDemo));
}
[AjaxPro.AjaxMethod]
public string EchoInput(string s)
{
return s += " (Hello from server)";
}
</script>
<!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 - KeyPress 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>KeyPressDemo Examples</h1>
<p>Press any key in the textbox and see the echo in the DIV element on the right side.</p>
<input type="text" id="myinput" onkeyup="doTest1();"/> <div id="mydisplay">---- empty ----</div>
<p><i>Note, that I do not update the display if a request is running currently.</i></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">
var timer = null;
function doTest1() {
if(timer != null) {
clearTimeout(timer);
}
timer = setTimeout(doTest1_next, 100);
}
function doTest1_next() {
var ele = document.getElementById("myinput");
ASP.KeyPressDemo.EchoInput(ele.value, doTest1_callback);
}
function doTest1_callback(res) {
var ele = document.getElementById("mydisplay");
ele.innerHTML = res.value;
}
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -