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

Javascript
IE中直接运行显示当前网页中的图片 推荐
广告显示判断
srcElement表格样式
免费空间广告万能消除代码
[原创]手机号码本地检测
JS实现浏览器菜单命令
JS代码混淆初步
经验几则 推荐
MSN消息提示类
正宗的日历(含农历)
农历与西历对照
在网页中屏蔽快捷键
简单获取键盘的KeyCode
音乐播放用的的几个函数
你的编程语言可以这样做吗?
如何遍历对象的属性?
自动关闭的层
prototype 的说明 js类
js脚本学习 比较实用的基础
日期函数扩展类Ver0.1.1

Javascript 中的 让焦点自动跳转


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 70 ::
收藏到网摘: 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>