敲回车,让光标移动到指定的TextBox中……
asp.net 在页面敲回车使光标自动跳到指定TextBox中并选中TextBox内容,选择内容后并且将内容变色。
请问如何实现?给具体实例!!!谢谢!
[解决办法]
$(document).bind(click,function(){
$("#txt1").focus().select();
})
[解决办法]
<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>