Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus to the last character of a textbox

Status
Not open for further replies.

mmarseil

Programmer
Apr 26, 1999
12
US
Does anyone know how to set focus to the last character of a textbox in vbscript.  For example when a page loads a value will be set in a textbox. Take the word "sample", for instance.  I want to set focus to the textbox and the cursor should appear after the "e" in "sample".  I know in normal VB you can use SelStart, but VBScript doesn't support this function.  Also, I've tried to populate that textbox and then set focus, hoping that the cursor would be at the end since there was already text in there, but it just put the cursor at the beginning of the word.  Any help would be greatly appreciated!!
 
How about formname.fieldname.focus(); <br>But this will only set focus on the textbox. <br><br>I think you would have to get the length of the text in the textbox by writing some code and then figure out a way to get to the last character of the string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top