Не, лучше так:
<script type="text/javascript">
window.onload = function(){
var handler = ['keyup', 'focus', 'change'], i = handler.length, id = document.getElementById("test");
while(i--){
id['on'+handler[i]] = function(i){
return function(){
var len = this.value.length, input = this;
this.size = (this.size < len)? len++ : len--;
window.setTimeout(function(){
if(handler[i] != handler[0] || handler[i] == handler[1]){
input.select();
}
}, 100);
};
}(i);
}
};
</script>
<input id="test" type="text" value="text" />