<html>
<head>
    <title>다음칸</title>
<script language='javascript'>

   var is_submit = true;
   var _NEXT_FOCUS = ""; // 커서가 갈 곳..

   function check_form(){

       f = document.form;

      if(is_submit == true){
         return true;
      }else{
         f[_NEXT_FOCUS].focus();
         is_submit = true;
         return false;
     }
   }

   function next_input(next_focus){
     if(event.keyCode == 13){
          is_submit = false;
         _NEXT_FOCUS = next_focus;
      }
   }

</script>


<body>
입력폼 아무곳에서나 엔터키를 쳐보세요..

<form name='form'>
   <input type='text' size=20 name='put1' onKeyDown="next_input('put2');"><br>
   <input type='text' size=20 name='put2' onKeyDown="next_input('put3');"><br>
   <input type='text' size=20 name='put3' onKeyDown="next_input('put4');"><br>
   <input type='text' size=20 name='put4' onKeyDown="next_input('put5');"><br>
   <input type='text' size=20 name='put5' onKeyDown="next_input('put1');"><br>
   <input type='submit' value='보내기' onClick='return check_form();'>
</form>

</body>
</html>
2010/06/07 14:16 2010/06/07 14:16

Trackback Address :: https://youngsam.net/trackback/1247