FireFox & IE中回车转换成Tab

<script>
function tabE(obj,e){
    var e=(typeof event!='undefined')?window.event:e;// IE : Moz
    if(e.keyCode==13){
        var ele = document.forms[0].elements;
        for(var i=0;i<ele.length;i++){
            var q=(i==ele.length-1)?0:i+1;// if last element : if any other
            if(obj==ele[i]){ele[q].focus();break}
        }
        return false;
    }
}
</script>
<FORM METHOD="POST" ACTION="" name="form1">
<INPUT TYPE="text" onkeydown="tabE(this,event)">
<INPUT TYPE="text" onkeydown="tabE(this,event)">
</FORM>

posted on 2009-03-12 10:19  Love2009  阅读(432)  评论(0编辑  收藏  举报

导航