views:

2168

answers:

2

Upon page load I want to move the cursor to a particular field. No problem. But I also need to select and highlight the default value that is placed in that text field.

+8  A: 

From http://www.codeave.com/javascript/code.asp?u_log=7004:

var text_input = document.getElementById ('myTextInput');
text_input.focus ();
text_input.select ();
John Millikin
+1  A: 

And do it on page-load:

<script type="text/javascript">
window.onload = function(){
  var text_input = document.getElementById ('myTextInput');
  text_input.focus ();
  text_input.select ();
}
</script>
roenving