<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function Gototimu(kk){
window.alert(kk);
}
</script>
</head>
<body> 到<input type="text" name="order" style="width:35px;font-weight: bold;" onKeyUp="if(event.code==13)Gototimu(document.all.order.value);" >
题
</body>
</html>
可以用回车来触发跳转表明输入完成了
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function Gototimu(kk){
window.alert(kk);
}
</script>
</head>
<body> 到<input type="text" name="order" style="width:35px;font-weight: bold;" onKeyUp="if(event.code==13)Gototimu(document.all.order.value);" >
题
</body>
</html>
可以用回车来触发跳转表明输入完成了
他支持输入1位或2为位数字注意是:修改第————题 这里
地址是:http://www.jsyks.com/mnks.asp
不知道他是怎么实现的,他的JS源代码也看不到期待高手出现。
要么,做一个延迟加载,if(tid==null) clearTimeout(tid);
setTimeout("do()",500);这样即时按第二个键时就不会触发第1次的
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
var tid = null;
function Gototimu(kk){
if(tid != null) clearTimeout(tid);
tid = setTimeout("doit('" + kk + "')", 500);
}
function doit(kk){
window.alert(kk);
}
</script>
</head>
<body> 到<input type="text" name="order" style="width:35px;font-weight: bold;" onKeyUp="Gototimu(document.all.order.value);" >
题
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
var to=null;
function Gototimu(tb){
if(tb.value=="") return;
if(to)clearTimeout(to);
var div=document.getElementById(tb.value);
if(div)
{
to=setTimeout("ShowSel('"+tb.value.replace("'","\'")+"')",300);
}
else
tb.value='';
}
function ShowSel(id)
{
var divs=document.getElementsByTagName("div");
for(var i=0;i<divs.length;i++)
{
divs[i].style.display="none";
}
document.getElementById(id).style.display='';
}
</script>
</head>
<body> 到<input type="text" name="order" style="width:35px;font-weight: bold;" onKeyUp="Gototimu(this);" >
题
<div id="1">第1题</div>
<div id="2" style="display:none">第2题</div>
<div id="3" style="display:none">第3题</div>
<div id="4" style="display:none">第4题</div>
<div id="5" style="display:none">第5题</div>
<div id="6" style="display:none">第6题</div>
<div id="7" style="display:none">第7题</div>
<div id="8" style="display:none">第8题</div>
<div id="9" style="display:none">第9题</div>
<div id="10" style="display:none">第10题</div>
<div id="11" style="display:none">第11题</div>
<div id="12" style="display:none">第12题</div>
<div id="13" style="display:none">第13题</div>
</body>
</html>
题
那这样是不是也行.