input自动聚焦功能

<input type="text" disabled="disabled" /><br>
<input type="text" />
<script>
var inps=document.getElementsByTagName('input');
for(var i=0;i<inps.length;i++){
if(inps[i].type=='text'&&inps[i].disabled!=true){
inps[i].focus();
break;
}
}
</script>

///////////////////自动选中
$(function(){
$(":text").focus(function(){
  this.select();
});
});

猜你喜欢

转载自eyebeer.iteye.com/blog/1700196