<div id="divName" style="left:190px; top:-7px; position:absolute; display:inline; width: 250px">
<input type="text" id="newName" name="newName" class="textstyle" style="background:url(image/login/text_background.jpg)" onKeyDown="textID()"></div><div id="divPass" style="left:190px; top:82px; position:absolute; display:inline; width: 250px;">
<input type="password" id="newPass" name="newPass" class="textstyle" style="background:url(image/login/text_background.jpg)" onKeyDown="textPass()"></div>function textID(){
if(event.keyCode==40){
document.getElementById('newPass').focus();
}
}
function textPass(){
if(event.keyCode==38){
document.getElementById('newName').focus();
}
if(event.keyCode==40){
document.getElementById('item_1').focus();
}
}
我这样获取text的id可以达到效果,但是我用层的ID试了下就不行了。
假设光标在载入页面的时候在divName层,我按下键盘的 ↓ 后,光标在divPass层。该咋整呢
<input type="text" id="newName" name="newName" class="textstyle" style="background:url(image/login/text_background.jpg)" onKeyDown="textID()"></div><div id="divPass" style="left:190px; top:82px; position:absolute; display:inline; width: 250px;">
<input type="password" id="newPass" name="newPass" class="textstyle" style="background:url(image/login/text_background.jpg)" onKeyDown="textPass()"></div>function textID(){
if(event.keyCode==40){
document.getElementById('newPass').focus();
}
}
function textPass(){
if(event.keyCode==38){
document.getElementById('newName').focus();
}
if(event.keyCode==40){
document.getElementById('item_1').focus();
}
}
我这样获取text的id可以达到效果,但是我用层的ID试了下就不行了。
假设光标在载入页面的时候在divName层,我按下键盘的 ↓ 后,光标在divPass层。该咋整呢
看看这个列子