67,513
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title>MyJsp.jsp</title>
</head>
<script>
function tabNext(obj){
//取得事件中的keycode并转成字符,并转为小写字符,因为默认大写
obj.value = String.fromCharCode(event.keyCode).toLowerCase();
event.keyCode=9;
}
</script>
<body>
This a struts page. <br>
<input type="text" tabindex="1" maxlength="1" onkeydown="tabNext(this)" ><br>
<input type="text" tabindex="2" maxlength="1" onkeydown="tabNext(this)"><br>
<input type="text" tabindex="3" maxlength="1" onkeydown="tabNext(this)"><br>
<input type="text" tabindex="4" maxlength="1" onkeydown="tabNext(this)"><br>
<input type="text" tabindex="5" maxlength="1" onkeydown="tabNext(this)"><br>
<input type="text" tabindex="6" maxlength="1" onkeydown="tabNext(this)"><br>
<input type="text" tabindex="7" maxlength="1" ><br>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<input type="text" id="tt_1" name="1_as" onpropertychange="autoFocus(this.id)"/>
<input type="text" id="tt_2" name="2_as" onpropertychange="autoFocus(this.id)"/>
<input type="text" id="tt_3" name="3_as" onpropertychange="autoFocus(this.id)"/>
<input type="text" id="tt_4" name="4_as" onpropertychange="autoFocus(this.id)"/>
<input type="text" id="tt_5" name="5_as" onpropertychange="autoFocus(this.id)"/>
<input type="button" id="b" name="b"/>
</body>
<script language="javascript">
function autoFocus(objId){
var id = Number(objId.split("_")[0])+1+"_as";
var next = document.getElementById(id);
if(next!=undefined){
next.focus();
}
}
</script>
</html>