当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 让焦点自动跳转

让焦点自动跳转

2019年07月31日  | 移动技术网IT编程  | 我要评论
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>html-www.51windows.net</title>
</head>
<body>
以下四个文本框,每个限输入四个字符,输入完后自动跳到下一文本框
<script id="clienteventhandlersjs" language="javascript">
<!--
function t1_onkeyup() {
if(document.card.t1.value.length==4){
document.card.t2.focus();
}
}
function t2_onkeyup() {
if(document.card.t2.value.length==4){
document.card.t3.focus();
}
}

function t3_onkeyup() {
if(document.card.t3.value.length==4){
document.card.t4.focus();
}
}
//-->
</script>
<form method="post" name="card" action>
输入字符:
<input type="text" name="t1" size="4" maxlength="4" language="javascript" onkeyup="return t1_onkeyup()">-

<input type="text" name="t2" size="4" maxlength="4" language="javascript" onkeyup="return t2_onkeyup()">-

<input type="text" name="t3" size="4" maxlength="4" language="javascript" onkeyup="return t3_onkeyup()">-

<input type="text" name="t4" size="4" maxlength="4">
</form>
</body>
</html>

<div style="position: absolute; top: 10; right: 10; width: 148; height: 18;cursor:hand">
<input type="button" name="button" value="查看源代码" onclick= 'window.location = "view-source:" + window.location.href'></div>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网