3
我一直在开发智能电视的tizen网络应用程序
有一个视图,我有很多输入,所以我需要设置它们之间的导航,实际上导航还有像的div和图片等元素,但一旦我是一个输入(聚焦状态)内我不能移动到任何其他元素 此功能工作的事件监听器函数如何调用输入内的关键事件
document.addEventListener('keydown',function(e) {
switch (e.keyCode) {
case TvKeyCode.KEY_LEFT:
navigation("left");
break;
case TvKeyCode.KEY_UP:
navigation("up");
break;
case TvKeyCode.KEY_RIGHT:
navigation("right");
break;
case TvKeyCode.KEY_DOWN:
navigation("down");
break;
case TvKeyCode.KEY_ENTER:
break;
}
});
这里的导航功能(inputindex已经被初始化为零)
function navigation(direction) {
if (direction == "up") {
$(".bottom-container").find("input").filter('input:eq('+inputindex+')').focus();
inputindex--;
}
if (direction == "down") {
$(".bottom-container").find("input").filter('input:eq('+inputindex+')').focus();
inputindex++;
}
if (direction == "left") {
//an other fnction
}
if (direction == "right") {
//an other function
}
}
这里的输入
<tr>
<td>Math:</td>
<td><input class="inputsize" type="number" size="4"
max="20" step="0" /></td>
<td><input class="inputsize" type="number" size="4"
max="20" step="0" /></td>
</tr>
<tr>
<td>Science:</td>
<td><input class="inputsize" type="number" size="4"
max="20" step="0" /></td>
<td><input class="inputsize" type="number" size="4"
max="20" step="0" /></td>
</tr>
任何帮助,请
你有输入事件监听器吗? – nottu
我想没有它只是一个简单的 –