TextBox Focus

Results 1 to 3 of 3

Thread: TextBox Focus

  1. #1
    Join Date
    Dec 1969

    Default TextBox Focus

    I was wondering if there was a "GotFocus event" for a textbox in <BR>ASP <BR><BR>Else, is it posible to set the tab order so that when my programm strats, the focus is on my second TextBox and not the first<BR><BR>Thanks<BR><BR>Alphonzo <BR>

  2. #2
    Join Date
    Dec 1969

    Default ASP?

    No.<BR><BR>Because ASP is server-side and the text-box is client side, so ASP cannot respond to client-side events.<BR><BR>Get yourself a decent book on ASP, so that you can learn about the merits and problems of client-server architecture, and methods to exploit and overcome these features.<BR><BR>If you want to do anything with regards to this, you need to work on the CLIENT side, using JavaScript if possible. Browsers do not support a tab order type property, but you can give an item focus using:<BR>&#060;script&#062;<BR>document.formname. elementname.focus();<BR>&#060;/script&#062;<BR>Make sure that is written AFTER the form element has been written to the screen, or you&#039;ll get a "Object expected" error.<BR><BR>Craig.

  3. #3
    Join Date
    Dec 1969

    Default RE: ASP?

    Or a slighty neater way to do would be to put the script into a function and then call it in the OnLoad, like:<BR><BR>&#060;HTML&#062;<BR>&#060;HEAD&#062;< BR>&#060;SCRIPT Language="JavaScript"&#062;<BR>Function SetFocus() {<BR>document.formname.elementname.focus();<BR>}<B R>&#060;/SCRIPT&#062;<BR>&#060;/HEAD&#062;<BR>&#060;BODY OnLoad="SetFocus()"&#062;<BR><BR>etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts