zoukankan      html  css  js  c++  java
  • 回车切换input选框

    在工作中许多时候需要考虑到用户体验,当按下回车键时切换input选框就来得十分必要。
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>按下回车键时自动切换焦点</title>
    <style type="text/css">
    .style1 {color: #FFFFFF}
    .wenbenkuang {
    font-family: "宋体";
    font-size: 9pt;
    color: #333333;
    border: 1px solid #999999;
    }
    </style>
     
    </head>
    <body style="font-size:12px">
    <table width="547" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
      <td height="8"></td>
      </tr>
      <tr>
      <td valign="top"><table width="532" border="0" align="center" cellpadding="0" cellspacing="0">
      <form name="form1">
      <tr>
      <td height="27" colspan="2" align="left" class="font_white">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="style1">用户注册</span></td>
      </tr>
      <tr>
      <td width="172" height="22" align="right">用户名称:</td>
      <td width="328" height="22"><input name="用户名称" type="text" class="wenbenkuang" id="用户名称" maxlength="50" onKeyPress="Myenter(form1.密码)" /></td>
      </tr>
      <tr>
      <td height="22" align="right">密
      码:</td>
      <td height="22"><input name="密码" type="password" class="wenbenkuang" maxlength="50" onKeyPress="Myenter(form1.真实姓名)" /></td>
      </tr>
      <tr>
      <td height="22" align="right">真实姓名:</td>
      <td height="22"><input name="真实姓名" type="text" class="wenbenkuang" id="真实姓名" size="30" maxlength="50" onKeyPress="Myenter(form1.联系方式)" /></td>
      </tr>
      <tr>
      <td height="22" align="right">联系方式:</td>
      <td height="22"><input name="联系方式" type="text" class="wenbenkuang" id="联系方式" size="30" maxlength="30" onKeyPress="Myenter(form1.Email)" /></td>
      </tr>
      <tr>
      <td height="22" align="right">E-mail:</td>
      <td height="22"><input name="Email" type="text" class="wenbenkuang" id="Email" size="30" maxlength="100" onKeyPress="Myenter(form1.add)"/></td>
      </tr>
      <tr>
      <td height="22" colspan="2" align="center"><input name="add" type="button" class="button" id="add" value="提 交" onClick="form1.submit();" />
    &nbsp;
      <input type="reset" name="Submit2" value="重 置" class="button" /></td>
      </tr>
      </form>
      </table></td>
      </tr>
      <tr>
      <td height="8" ></td>
      </tr>
    </table>
    <script type="text/javascript">
    function Myenter(str){
    //判断是否点击回车,是的话str获取焦点
      if (event.keyCode == 13){
      str.focus();}
    }
    </script>
    </body>
    </html>
  • 相关阅读:
    暑期测试训练3
    对于在线段树上修改整段区间的理解
    UVA 11090 判负圈问题
    ZOJ 2588 求割边问题
    POJ 1523 网络连通
    hdu 1163
    hdu 1703
    hdu 2577 模拟
    hdu 3836 强连通+缩点:加边构强连通
    hdu 2571
  • 原文地址:https://www.cnblogs.com/dxzg/p/6409740.html
Copyright © 2011-2022 走看看