日期:2009-09-12  浏览次数:20842 次

<HTML>
<head>
<script language="javascript">
function go1()

{
key=window.event.keyCode;
if (key==38){
    CurTabIndex=event.srcElement.tabIndex-1
    for (n=0;n<form1.elements.length;n++){
        if (form1.elements[n].tabIndex==CurTabIndex){
            form1.elements[n].focus();
            return true;
            }
        }
    }
if (key==40){
    CurTabIndex=event.srcElement.tabIndex+1
    for (n=0;n<form1.elements.length;n++){
        if (form1.elements[n].tabIndex==CurTabIndex){
            form1.elements[n].focus();
            return true;
            }
        }
    }
}
</script>
</head>
<body>
<form name="form1" method="post" onkeyup="return go1()" language="javascript">
<input name=input1 type="text"><br>
<input name=input2 type="text"><br>
<input name=input3 type="text"><br>
…………
<input name=inputN type="text"><br>
</form>
<script>
form1.input1.focus();
for (n=0;n<form1.elements.length;n++){
    form1.elements[n].tabIndex=n;
}
</script>
</body>
</HTML>