Introduction
Last day when I saw a banking website that supports the function keys I thought to write an article on this topic. I don't know what platform they (the bank) are using but I thought to write it in ASP.NET.
I am going to consume the jQuery methods to make it possible. So, use the following steps to create this application.
Step 1:
Add reference to the jQuery file in the head section of the page, for example:
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
Step 2:
Add the following jQuery method in the head section of the page.
<script type="text/javascript">
$(function () {
$(document).keyup(function (e) {
var key = (e.keyCode ? e.keyCode : e.charCode);
switch (key) {
case 112:
navigateUrl($('a[id$=lnk1]'));
break;
case 113:
navigateUrl($('a[id$=lnk2]'));
break;
case 114:
navigateUrl($('a[id$=lnk3]'));
break;
default: ;
}
});
function navigateUrl(jObj) {
window.location.href = $(jObj).attr("href");
}
});
</script>
Step 3:
Here is the list of function keys and their key codes:
|
Function key |
Key code |
|
F1 |
112 |
|
F2 |
113 |
|
F3 |
114 |
|
F4 |
115 |
|
F5 |
116 |
|
F6 |
117 |
|
F7 |
118 |
|
F8 |
119 |
|
F9 |
120 |
|
F10 |
This key is reserved by the system and cannot be used |
|
F11 |
122 |
|
F12 |
123 |
|
F13 |
124 |
|
F14 |
125 |
|
F15 |
126 |

Vishnu BhangalePosted Feb 13, 2018, 11:01 PM
Hi any one help me to open show div when we press F1 i try above but it always open browser Help tab
SrinivasPosted Oct 14, 2014, 2:03 AM
thank u very much .This code is very helpful to me
Debosree MukherjeePosted Dec 20, 2012, 2:18 AM
Very helpful post. But please let me know whether F1 really works on this logic. Because in my case only F1 is not working rather its opening the help file of the ie.
Anil KumarPosted Feb 14, 2012, 11:57 PM
Thank you for sharing this
EdPosted Feb 8, 2012, 12:12 PM
the code link seems broken
Sonakshi SinghPosted Feb 7, 2012, 11:02 PM
Good implementation
Monika AroraPosted Feb 7, 2012, 10:57 PM
Its a very nice and useful article.
Alok PandeyPosted Feb 7, 2012, 10:56 PM
Very useful article.
Arjun PanwarPosted Feb 7, 2012, 10:45 PM
Thank you, really appreciate for this article.
Sam HobbsPosted Feb 7, 2012, 7:07 PM
Thank you, Abhimanyu; that is useful. Yes, Windows applications do not use function keys as much as they could.