通过键盘事件判断敲击的是那个按键,如果是回车,判断所在input然后自定义那个input获得焦点
解决方案 »
- ExtJS store中如何获取action的返回值作为参数
- 访问iframe中的ID怎么访问呀。
- 浏览器兼容性问题
- ajax调用js问题
- 这个是怎么了?
- 关于Javascript对像继承的问题!!!
- 如何使用jsp把db2数据库中的记录导入access数据库中,分不够可以加。
- 属性问题!!!!!!
- 问个小问题,如何实现后退,谢谢大家!
- 大神们 求救 ajax定时请求数据之后 就不执行前面js效果的 应该怎么解决啊
- 请问javascript中有没有类似PHP的bin2hex函数,并能支持UTF-8类型的中文成为Hex?
- 我想学习JS,但是一定要在记事本内手写代码吗?现在我有VS2008,能用VS2008开发环境练习JS吗?
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript">
document.onkeydown = function(){
if (event.keyCode==13) {
event.keyCode = 9;
}
}
</script>
</head>
<body>
<table>
<tr>
<td>
<input type="text" tabindex="1"/>
</td>
<td>
<input type="text" tabindex="2"/>
</td>
<td>
<input type="text" tabindex="3"/>
</td>
</tr>
<tr>
<td>
<input type="text" tabindex="4"/>
</td>
<td>
<input type="text" tabindex="5"/>
</td>
<td>
<input type="text" tabindex="6"/>
</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title> </head> <body>
<table>
<tr>
<td><input type="text" id="a1" tabIndex="1"/></td>
<td><input type="text" id="a4" tabIndex="4"/></td>
<td><input type="text" id="a7" tabIndex="7"/></td>
</tr>
<tr>
<td><input type="text" id="a2" tabIndex="2"/></td>
<td><input type="text" id="a5" tabIndex="5"/></td>
<td><input type="text" id="a8" tabIndex="8"/></td>
</tr>
<tr>
<td><input type="text" id="a3" tabIndex="3"/></td>
<td><input type="text" id="a6" tabIndex="6"/></td>
<td><input type="text" id="a9" tabIndex="9"/></td>
</tr>
</table>
<script type="text/javascript">
<!--
document.onkeydown = function(e){
var e = e || window.event;
var keyCode = e.keyCode || e.which;
var oTarget = e.srcElement || e.target;
if(keyCode == 13){
if(oTarget.type == "text"){
var tabIndex = oTarget.tabIndex;
tabIndex++;
}
}
var oInput = document.getElementsByTagName("input");
for(var i =0;i < oInput.length;i++){
if(oInput[i].type == "text" && oInput[i].id.indexOf('a') != -1){
if(oInput[i].tabIndex == tabIndex){
oInput[i].focus();
}
}
}
}
//-->
</script>
</body>
</html>