This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

selecting text area at focus

 
Harry Chawla
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I was wondering if i can select the text area in a text box, whenever the that text box gets the focus; usingJavascript or DHTML.
Any suggestions will be highly appreciated.
Thanks.
 
bill bozeman
Ranch Hand
Posts: 1070
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, with the text boxes, have an onFocus event that does the following function:
document.form_name.field_name.select();
Or you can probably put the function right there in the code that says:
<input type="text" onFocus="javascript:this.select();">
Haven't tried the second version, but may work.
Bill
[This message has been edited by bill bozeman (edited January 04, 2001).]
 
Harry Chawla
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill
Thanks a lot for ur invaluable tips.
I tried the second version
onFocus="javascript:this.select();"
and it works fine on IE. In netscape, it works fine if one uses keyboard but with mouse, it selects on the text on the left hand side from the point of click and doesn't select any text on righthandside. I'm still wondering if i can use something to work the same way on both these browsers.
BTW how good is the Javascript book by ORiely. I'd prefer to get a book preferable which has good stuff on both Javascript and DHTML. Do u have any recommenddation?
Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic