读书人

敲回车让光标移动到指定的TextBox中

发布时间: 2012-04-05 12:42:40 作者: rapoo

敲回车,让光标移动到指定的TextBox中……
asp.net 在页面敲回车使光标自动跳到指定TextBox中并选中TextBox内容,选择内容后并且将内容变色。
请问如何实现?给具体实例!!!谢谢!


[解决办法]
$(document).bind(click,function(){
$("#txt1").focus().select();
})

[解决办法]

探讨

$(document).bind(click,function(){
$("#txt1").focus().select();
})

[解决办法]
探讨

引用:
$(document).bind(click,function(){
$("#txt1").focus().select();
})

给完整一点,半途而废没用呀

[解决办法]
window.onload = function() {

document.getElementById("txt1").focus();
document.getElementById("txt1").select();
}
[解决办法]
在window.keyup上判断event.keycode,如果是enter(13),
document.getElementById("txt1").focus();
document.getElementById("txt1").select();
//以及设置其他央视

[解决办法]
HTML code
<html xmlns="http://www.w3.org/1999/xhtml"><head>    <title></title>    <script type="text/javascript">        window.onload=function(){            document.body.onkeydown=function(e){                e=e||window.event;                var keyCode = e.keyCode||e.which||e.charCode;                if(keyCode==13){                    document.getElementById("Text1").focus();                    document.getElementById("Text1").select();                    return false;                }            }        }    </script></head><body style="height:100%">     <input id="Text1" type="text" value="aaa" />   </body></html> 

读书人网 >asp.net

热点推荐