#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2004
    Location
    India
    Posts
    21
    Rep Power
    0

    Javascript form element focus


    I have three forms in a single page.On top of the page i have three links to get each of the forms.I want to set focus for the first element of each form,

    so if i select first form, the curser should be focussed on to the first textbox of that form,

    if i select the second form, the curser should be focussed on to the first textbox of that form,

    if i select third form, the curser should be focussed on to the first textbox of that form

    How can i do that?
  2. #2
  3. Contributing User
    ASP Scholar (3000 - 3499 posts)

    Join Date
    Jun 2004
    Posts
    3,072
    Rep Power
    194
    Hi

    Try:

    Code:
    document.Form1.Field1.focus();
    Obviosuly, change Form1 and Field1 to meaningful names on your page. You could also try:

    Code:
    document.forms[0].[0].focus();
    I think this should focus on the first element of the first form (or maybe it's [0][0]?)

    MK

Similar Threads

  1. Form Validation using Javascript, JScript in ASP file
    By Barnes in forum ASP Development
    Replies: 7
    Last Post: July 1st, 2004, 01:22 PM
  2. Error msg when a form element is empty
    By xagiber in forum ASP Development
    Replies: 5
    Last Post: May 2nd, 2004, 11:18 AM
  3. Javascript Generic Form validation
    By danosullivan in forum HTML, JavaScript And CSS Help
    Replies: 2
    Last Post: February 25th, 2004, 01:34 AM
  4. how to create hidden form for javascript?
    By keith_foo in forum ASP Development
    Replies: 4
    Last Post: January 30th, 2004, 01:18 PM
  5. JavaScript focus problem
    By CharlesTheHawk in forum HTML, JavaScript And CSS Help
    Replies: 2
    Last Post: January 26th, 2004, 10:00 PM

IMN logo majestic logo threadwatch logo seochat tools logo