반응형
<script language="JavaScript">
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
var tar = event.srcElement.form;
var Tindex = "";
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
var tar = event.srcElement.form;
var Tindex = "";
if (window.event && window.event.keyCode == 40){
for(i=0;i<tar.elements.length;i++){
if(tar.elements[i] == event.srcElement) Tindex = i;
if(Tindex !== i && Tindex !== "" && tar.elements[i].type == "text"){
tar.elements[i].focus();
break;
}
}
}else if (window.event && window.event.keyCode == 38){
for(i=0;i<tar.elements.length;i++){
if(tar.elements[i] == event.srcElement) Tindex = i;
if(Tindex !== i && Tindex !== "" && tar.elements[i].type == "text"){
tar.elements[i].focus();
break;
}
}
}else if (window.event && window.event.keyCode == 38){
for(i= (tar.elements.length - 1);i>=0;i--){
if(tar.elements[i] == event.srcElement) Tindex = i;
if(Tindex !== i && Tindex !== "" && tar.elements[i].type == "text"){
tar.elements[i].focus();
break;
}
}
}
}
</script>
if(Tindex !== i && Tindex !== "" && tar.elements[i].type == "text"){
tar.elements[i].focus();
break;
}
}
}
}
</script>
반응형
'Story > Javascript' 카테고리의 다른 글
경고창 없이 창닫기 (0) | 2009.01.19 |
---|---|
새로고침을 막는 자바스크립트 (0) | 2009.01.19 |
array 객체에 push 메소드가 정의 되지 않았다고 나올때 (0) | 2009.01.19 |
javascript convert HtmlEntities To Characters (0) | 2009.01.09 |
javascript convert unicode (0) | 2009.01.09 |