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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting focus at beginning of text

Status
Not open for further replies.

boatdrinks

IS-IT--Management
Jun 18, 2004
51
US
When you tab to this textbox 'dci.gov' appears, I would like the cursor to be placed at the beginning not the end though.

<asp:Textbox id="Insertemail" maxlength="30" onfocus="javascript:if (this.value == '') {this.value = '@dci.gov';}" width="175" onkeypress="return noenter()" runat="server" />

Is that possible?
 
Try this:
Code:
function doFocus(elem)
{
  var text = elem.value;
  elem.value = "";
  elem.focus();
  elem.value = text;
}

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top