asp.net Web表单中的快捷键 [英] shortcut key in asp.net web form

查看:72
本文介绍了asp.net Web表单中的快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

i在asp.net中有一个web表单,这里有一个文本框控件我想设置这个控件的焦点意味着当我们按F2键然后光标移动文本框





谢谢和问候

Srishti

Hello,
i have a web form in asp.net in this there is a text box control i want to set focus of this control means when we press F2 key then cursor is move on text box


Thanks & Regards
Srishti

推荐答案

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

    <script language="Javascript">

function MoveFocusOnF2(event) {
    switch (event.keyCode) {
    case 113:
    document.getElementById("TextBox1").focus();
    break;
    default:
    //nothing
    }
}
    </script>
</head>
<body onkeydown="MoveFocusOnF2(event);">
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>


Below link got key values for all keys

http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes


这篇关于asp.net Web表单中的快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆