:::: 개발 ::::/::: JSCRIPT :::

input focus 자동 변경

nayha 2010. 6. 21. 11:29
반응형
<script>
// 포커스 자동이동 스크립트
function focus_chk(obj,tar,num){ var openerFmNm = eval("document.all."+tar+"");    if (obj.value.length == num){        openerFmNm.focus();    }else if(obj.value.length != num ){        obj.focus();    } } </script> <table> <tr> <td class="td_head" height="22">전화 번호</td> <td class="nor_w">&nbsp; <input type="text" size="3" maxlength="3" name="ph" class="inbox" onkeyup="focus_chk(this,'ph[1]',3)"> <input type="text" size="4" maxlength="4" name="ph" class="inbox" onkeyup="focus_chk(this,'ph[2]',4)"> <input type="text" size="4" maxlength="4" name="ph" class="inbox"> </td> </tr> </table>

TAEYO.PE.KR 펌
반응형