回车键转tab键
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'left.jsp' starting page</title>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery-1.5.2.js"></script>
<script type="text/javascript">
//$(function(){
// $("#name").focus();
//});
//$(function(){
/*function load(){
var input=document.getElementsByTagName("input");
//alert(input.length);
var event = window.event || arguments[0];
for(var i=0;i<input.length;i++){
document.getElementById("textf"+i).onkeydown=function (){
//alert("333");
//alert("555");
// if(event.keyCode == 13){
// var textid=i+1;
// event.keyCode=9;
var index=i;
alert(index);
$("input:text:eq("+index+")").focus();
//}
//$("#textf"+(i+1)).focus();
//event.keyCode = (event.keyCode == 13)?9:event.keyCode;
}
}
}*/
$(function(){
$("input:eq(0)").focus();
var $input = $("input");
$input.bind("keydown",function(e){
var key = e.which;
if(key==13){
e.preventDefault();
var index= $input.index(this)+1;
if(index==4){
$("#subForm").submit();
index=0;
//$("input:eq("+index+")").css("border-color","blue");
}
alert(index);
console.log(index);
$("input:eq("+index+")").focus();
//$("input:eq("+index+")").css("border-color","blue");
//$("input:eq("+index+")").parent().parent().siblings().find("input").css("border-color","#ccc");
}
});
});
//});
//var document.getElementsByTagName("input");
//function getName(){
// event.keyCode = (event.keyCode == 13)?9:event.keyCode;
//}
//function getName(){
// $("#age").focus();
//}
//function getAge(){
// $("#hobby").focus();
//}
//function getHobby(){
// $("#sub").focus();
//}
</script>
<style type="text/css">
input:focus{
border:1px solid red;
}
</style>
</head>
<body>
<form action="www.baidu.com" id="subForm" method="post">
<table>
<tr>
<td>姓名</td>
<td><input type="text" id="textf0" /></td>
</tr>
<tr>
<td>年龄</td>
<td><input type="text" id="textf1" /></td>
</tr>
<tr>
<td>爱好</td>
<td><input type="text" id="textf2" /></td>
</tr>
<tr>
<td></td>
<td><input type="button" id="textf3" onclick="return document.forms[0].submit();" value="确定"/></td>
</tr>
</table>
</form>
</body>
</html>
回车键转tab键的更多相关文章
- 使用回车键代替TAB键 需jquery1.4.2版本
1 $(document).ready(function () { 2 $(':input:text:first').focus(); 3 $(':input:enabled').addClass(' ...
- 将回车键转tab键
//功能:将回车键转tab键$(function () {$('input:text:first').focus();var $enter = $("input[type=text],but ...
- 回车键转tab键解决方案一
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- PB中用回车键实现tab键的功能
先编辑控件的TabOrder顺序,然后在 global external functions 中定义一个API:Subroutine keybd_event(int bVk,int bScan,ulo ...
- 将回车键转换为Tab键
实现效果: 知识运用: KeyEventArgs类的KeyValue属性 public int KeyValue {get;} //获取KeyDown或KeyUp事件的键盘值 SendKeys类的Se ...
- 回车键转tab键解决方案二
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- C语言 统计一串字符中空格键、Tab键、回车键、字母、数字及其他字符的个数(Ctrl+Z终止输入)
//凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ #include<stdio.h> void main(){ , num=, blank=, ...
- JQuery实现回车代替Tab键(按回车跳到下一栏)
一个提交按钮以后,用户如果按了键盘的回车键,默认情况下,就会提交这个表单了.这样对于用户输入各个表单项目,用户体验很不好,输入完一个项目,或者用鼠标选择下一个项目,或者用键盘的Tab键选中下一个项目. ...
- WinForm中变Enter键为Tab键实现焦点转移的方法
if (e.KeyCode == Keys.Enter) { //this.SelectNextControl(this.ActiveControl,true, true, true, true); ...
随机推荐
- PRML读书笔记——Mathematical notation
x, a vector, and all vectors are assumed to be column vectors. M, denote matrices. xT, a row vcetor, ...
- 【翻译】hololens入门
欢迎!我们很高兴您发现这里并做好了全息投影奇幻之旅的准备.本页面的全部内容都经由我们的工程师团队精心打造,因此这会让人觉得本页面是由软件工程师制作(别忘了,我们是全息投影技术的缔造者,而不是网页制 ...
- POJ - 2183 Bovine Math Geniuses
“模拟“题,运用哈希,不断地按照一定运算规律对一个结果进行计算,如果重复出现就停止并且输出该数.注意到仔细看题,这种题一定要细心! POJ - 2183 Bovine Math Geniuses Ti ...
- mysql出现“SELECT list is not in GROUP BY clause and contains nonaggregated column [duplicate]”错误提示
项目跨平台时由于mysql设置的问题,原代码运行出现这个错误,此时把mysql设置改下就好了 sql_mode='NO_ENGINE_SUBSTITUTION'
- 注册、卸载DLL
注册.卸载DLL,一般命令写在bat文件中,下面以注册.卸载SWFToImage.DLL为例. 1.注册文件(Install.bat)内容: REM copying files to the syst ...
- jquery判断id是否存在
1.判断标签是否存在 ){ 存在 } 2.判断(id="id名"的标签)是否存在,下面的不可以!!!因为 $("#id") 不管对象是否存在都会返回 objec ...
- Spring中的事物管理,用 @Transactional 注解声明式地管理事务
事物: 事务管理是企业级应用程序开发中必不可少的技术, 用来确保数据的 完整性和 一致性. 事务就是一系列的动作, 它们被当做一个单独的工作单元. 这些动作要么全部完成, 要么全部不起作用 事务的四 ...
- js产生随机数并加入数组
<!doctype html> <html lang="zh-CN"> <head> <meta charset="utf-8& ...
- 【Python】我的Python学习笔记【2】【using Python 3】
... 1. 在语法上,返回一个tuple可以省略括号,而多个变量可以同时接收一个tuple,按位置赋给对应的值, 所以,Python的函数返回多值其实就是返回一个tuple,但写起来更方便. 2. ...
- [poj2777] Count Color (线段树 + 位运算) (水题)
发现自己越来越傻逼了.一道傻逼题搞了一晚上一直超时,凭啥子就我不能过??? 然后发现cin没关stdio同步... Description Chosen Problem Solving and Pro ...