当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 让焦点自动跳转

Javascript
各种浏览器兼容问题
取得父标签
JS用 或 || 来兼容FireFox!
JavaScript的Function详细
关于IE只能嵌套27层表格的说法证明
xmlHTTP返回值重编码的优化
静态网页加密
来访统计
炽热的文字
发一个分页的js
琥珀无限级联动菜单-JavaScript版
用javascript连接access数据库的方法
用js得到网页中所有的div的id
cloneNode实现表格增加删除效果
支持IE和FF的div+css选项卡
arguments对象
使两个iframe的高度与内容自适应,且相等
云网广告中的代码,提示出错,大家找找
document.all与WEB标准
表单内同名元素的控制

Javascript 中的 让焦点自动跳转


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 95 ::
收藏到网摘: n/a

<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>