日期:2014-05-18  浏览次数:20445 次

求一个JS代码,解决马上给分
gridview中有三列为TextBox.
怎样用JS实现:按   回车键   光标移到下一个TextBox(在第三个TextBox上回车,光标到下一行的第一个TextBox)

------解决方案--------------------
加上attribute
js代码:

onkeydown= 'keydown(event) '

function keydown(e,num){
e=e||window.event;
if(e.keyCode==13){
document.getElementById( 'textbox1 ').focus();
}
}

textbox的id你可以动态的赋值
或者用nextSibling一直得到tag=input为止
------解决方案--------------------
错误:由于该控件目前不可见........因此无法把焦点移向它
加上
function keydown(e,num){
e=e||window.event;
if(e.keyCode==13){
document.getElementById( 'textbox1 ').style.display= ' ';
document.getElementById( 'textbox1 ').focus();
}
}