<input type="text" onfocus="this.select()" onMouseUp="return false" />
or :
<script type="text/javascript">
function selectAll(id) {
var textBox = document.getElementById(id);
textBox.select();
textBox.readOnly = true;
textBox.onmouseup = function() {
textBox.select();
return false;
};
textBox.onmousedown = function() {
textBox.select();
return false;
};
};
</script>