Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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
在不使用javascript的情况下使用enter键单击HTML href_Html_Keyboard Events_Enter_Buttonclick - Fatal编程技术网

在不使用javascript的情况下使用enter键单击HTML href

在不使用javascript的情况下使用enter键单击HTML href,html,keyboard-events,enter,buttonclick,Html,Keyboard Events,Enter,Buttonclick,嗨,我有一个包裹在图像标签中的div,如下所示: <div id="SubmitButtonDIV" style="position: relative; left: 70px; top: 15px"><img id="btnDOB" alt="" src="PsychOImages/calculate-white.jpg" onmouseover="this.style.cursor='pointer';" tabindex=4 /></div> 我想

嗨,我有一个包裹在图像标签中的div,如下所示:

<div id="SubmitButtonDIV" style="position: relative; left: 70px; top: 15px"><img
id="btnDOB" alt="" src="PsychOImages/calculate-white.jpg"
onmouseover="this.style.cursor='pointer';" tabindex=4 /></div>

我想在它上面使用键盘控件,我已经将它的选项卡索引设置为4,现在当选项卡到达Div中包含的这个图像时我想使用回车按钮来点击它,而不是鼠标点击


是否有一个不使用JavaScript的HTML属性

为什么不在图像周围加一个a href,然后在那里设置tabindex?

我试过了,但没有成功。。。在“btnDOB”图像点击处有一个jquery函数调用…..正是如此。这就是锚定标签的作用。我已经变成了类似“”的东西,但仍然没有帮助
$('#btnDOB').keydown(function(e) {
    if(e.keyCode == '13')
    {
        //Do your thing
    }
});