onClick="select_text();"

ok. lets say i have a field, and as soon as you click on that field, you want all the text contained within the field to be selected automatically. well, you can do that with javascritp on this tutorial i will show you how you can do that.

here is the demonstration example
and here is the code i used:
<script type="text/javascript">
function select_text()
{
var content=eval("document.myform.field");
content.focus();
content.select();
}
</script>
<form method="post" action="" name="myform" >
<textarea name="field" rows="4" cols="40" onClick="select_text();">Click Inside the text area to select all
  text within this form field </textarea>
</form>


hope you learned something from this short and useful tutorial

courtesy of www.webune.com