<script type="text/javascript">
document.onkeyup = KeyCheck;
function KeyCheck(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
document.onkeyup = KeyCheck;
function KeyCheck(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
//alert("KeyId="+KeyID);
switch (KeyID) {
case 118:
__doPostBack('__Page', 'F7');
break;
case 119:
__doPostBack('__Page', 'F8');
break;
case 120:
__doPostBack('__Page', 'F9');
break;
case 121:
__doPostBack('__Page', 'F10');
break;
}
}
</script>
case 118:
__doPostBack('__Page', 'F7');
break;
case 119:
__doPostBack('__Page', 'F8');
break;
case 120:
__doPostBack('__Page', 'F9');
break;
case 121:
__doPostBack('__Page', 'F10');
break;
}
}
</script>
Code Behind write:
protected void Page_Load(object sender, EventArgs e)
{
Page.ClientScript.GetPostBackEventReference(this, "");
string eventArgs = Request["__EVENTARGUMENT"]; if (!string.IsNullOrEmpty(eventArgs))
{
switch (eventArgs)
{
case "F7":
a("F7");
break;
case "F8":
a("F8");
break;
case "F9":
a("F9");
break;
case "F10":
a("F10");
break;
}
}
}
{
Page.ClientScript.GetPostBackEventReference(this, "");
string eventArgs = Request["__EVENTARGUMENT"]; if (!string.IsNullOrEmpty(eventArgs))
{
switch (eventArgs)
{
case "F7":
a("F7");
break;
case "F8":
a("F8");
break;
case "F9":
a("F9");
break;
case "F10":
a("F10");
break;
}
}
}
public void a(string str)
{
Response.Write("You pressed : " + str);
}
{
Response.Write("You pressed : " + str);
}
No comments:
Post a Comment