Enter键代替Tab键例子:

Enter键代替Tab键例子:  
  <!--   TWO   STEPS   TO   INSTALL   TAB   KEY   EMULATION:  
   
      1.     Copy   the   coding   into   the   HEAD   of   your   HTML   document  
      2.     Add   the   last   code   into   the   BODY   of   your   HTML   document     -->  
   
  <!--   STEP   ONE:   Paste   this   code   into   the   HEAD   of   your   HTML   document     -->  
   
  <HEAD>  
   
  <SCRIPT   LANGUAGE="JavaScript">  
   
  nextfield   =   "box1";   //   name   of   first   box   on   page  
  netscape   =   "";  
  ver   =   navigator.appVersion;   len   =   ver.length;  
  for(iln   =   0;   iln   <   len;   iln++)   if   (ver.charAt(iln)   ==   "(")   break;  
  netscape   =   (ver.charAt(iln+1).toUpperCase()   !=   "C");  
   
  function   keyDown(DnEvents)   {   //   handles   keypress  
  //   determines   whether   Netscape   or   Internet   Explorer  
  k   =   (netscape)   ?   DnEvents.which   :   window.event.keyCode;  
  if   (k   ==   13)   {   //   enter   key   pressed  
  if   (nextfield   ==   'done')   return   true;   //   submit,   we   finished   all   fields  
  else   {   //   we're   not   done   yet,   send   focus   to   next   box  
  eval('document.yourform.'   +   nextfield   +   '.focus()');  
  return   false;  
              }  
        }  
  }  
  document.onkeydown   =   keyDown;   //   work   together   to   analyze   keystrokes  
  if   (netscape)   document.captureEvents(Event.KEYDOWN|Event.KEYUP);  
  //     End   -->  
  </script>  
  </HEAD>  
   
  <!--   STEP   TWO:   Copy   this   code   into   the   BODY   of   your   HTML   document     -->  
   
  <BODY>  
   
  <center>  
  <form   name=yourform>  
  Box   1:   <input   type=text   name=box1   onFocus="nextfield   ='box2';"><br>  
  Box   2:   <input   type=text   name=box2   onFocus="nextfield   ='box3';"><br>  
  Box   3:   <input   type=text   name=box3   onFocus="nextfield   ='box4';"><br>  
  Box   4:   <input   type=text   name=box4   onFocus="nextfield   ='done';"><br>  
  <input   type=submit   name=done   value="Submit">  
  </form>  
  </center>
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值