[英]How to detect JavaScript key events in Windows Mobile 5 browser?
I have a text box on a webpage which upon pressing the enter key, it should do something. 我在网页上有一个文本框,按Enter键后,它应该会执行某些操作。 So I detect the key code for the Enter key onkeyup.
因此,我检测到Enter键onkeyup的键代码。
My issue is, it appears that any JavaScript key events (keypress, keydown, keyup) do not work in the Windows Mobile 5 IE browser? 我的问题是,似乎任何JavaScript键事件(键,键按下,键按下)在Windows Mobile 5 IE浏览器中均不起作用? I've tried onlblur as well.
我也尝试过onlblur。 I'm looking for a JavaScript solution ideally.
我正在寻找理想的JavaScript解决方案。
I've seen some suggestions on the web about setting KeyPreview to true, but that appears to be only for Windows Forms. 我已经在网上看到一些有关将KeyPreview设置为true的建议,但这似乎仅适用于Windows窗体。
HTML example (seems to work fine in situations other than this): HTML示例(在其他情况下似乎可以正常工作):
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function isEnterPressed(){
if (window.event.keyCode == 13) {
alert("Enter was pressed!");
}
}
</script>
</head>
<body onload="document.getElementById('txtEntry').focus();">
<span>
Press the enter key...if enter is detected, message will display below.
</span>
<br />
<input type="text" id="txtEntry" onkeyup="isEnterPressed()">
</body>
</html>
If this is really Windows Mobile 5 there is no way to get JavaScript events for key presses as JScript in Windows Mobile 5 does simple NOT support any key event. 如果这确实是Windows Mobile 5,则无法获取按键的JavaScript事件,因为Windows Mobile 5中的JScript确实不支持任何按键事件。 Javascript Key event support started with Windows Mobile 6 (AKU 6.1.4 or so).
Windows Mobile 6(AKU 6.1.4左右)开始支持Javascript密钥事件。
There are third party 'browser' like Intermec Browser, NaurTecc and zetakey that either support javascript key events or provide a workaround using special META tags or setup that is captured by the browser 'wrapper'. 有第三方“浏览器”,例如Intermec浏览器,NaurTecc和zetakey,它们支持javascript键事件或使用特殊的META标签或由浏览器“包装器”捕获的设置来提供解决方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.