Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
不带alt键的HTML元素键盘快捷键_Html_Access Keys - Fatal编程技术网

不带alt键的HTML元素键盘快捷键

不带alt键的HTML元素键盘快捷键,html,access-keys,Html,Access Keys,我有一个可以通过键盘快捷键访问的按钮,但是用户必须按ALT+Z。是否有任何方法可以让用户只需按Z(或其他键)而不必按ALT来访问该按钮 非常感谢, <input style="display:none;" id='stopButton1' type="button" value="Z" onclick="stop('z')" accesskey="z" /> 不,这在纯HTML中是不可能的 需要JavaScript:使用keypress事件检测特定字符代码,并调用一些函数。我们可以

我有一个可以通过键盘快捷键访问的按钮,但是用户必须按ALT+Z。是否有任何方法可以让用户只需按Z(或其他键)而不必按ALT来访问该按钮

非常感谢,

<input style="display:none;" id='stopButton1' type="button" value="Z" onclick="stop('z')" accesskey="z" />

不,这在纯HTML中是不可能的


需要JavaScript:使用
keypress
事件检测特定字符代码,并调用一些函数。

我们可以使用
jquery2.1.3
插件和
keypress
ASCII

JS:

HTML:

按H/H键进入主页

这是

给出任何示例/syntaxnice知道我们可以在没有jquery插件的情况下使用它
$(document).keypress(function (e) {
    if (e.which == 72 || e.which==104) {
        window.location.replace("http://soluvations.in");
    }
});
<p>Press H/h to go to Home Page</p>