本文介绍了功能键F2的键控代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
在F2中,按下文本框按键事件,我需要显示一个弹出窗口.即使我使用F2的键码为113,也无法正常工作.我在javascript中将此ketpress事件编写为
if(window.event&& window.event.keyCode == 113)
{
popup.show();
}
但这是行不通的.可以问一个理由或为F2提供合适的代码吗?
Hi every one,
On F2 press in textbox keypress event i need to show a popup window. Even though i use keycode of F2 as 113, its not working. I write this ketpress event in javascript as
if(window.event && window.event.keyCode == 113)
{
popup.show();
}
but this is not working. can any one sujjest the reason or provide the suitable code for F2 press
推荐答案
<script language="javascript">
document.onkeyup = KeyCheck;
function KeyCheck(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
if(KeyID == 113)
{
alert("hi");
}
}
</script>
这篇关于功能键F2的键控代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!