Getting automatic focus on first text item just after running programme

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikas251074
    New Member
    • Dec 2007
    • 198

    Getting automatic focus on first text item just after running programme

    Can I get automatic focus on first text item just after running programme? Because when I run the programme, there is no focus on any text item at the first instant. I have to use mouse to go to first text item.
    So Can I get automatic focus on first text item just after running programme?

    Thanks and regards,
    Vikas
  • idsanjeev
    New Member
    • Oct 2007
    • 241

    #2
    please try

    Code:
    <form name="myform">Name:  <input type="text" name="fieldname" size=10></form>
    Insert into body Tag
    Code:
     OnLoad="document.myform.fieldname.focus();"
    regards
    jha

    Comment

    • vikas251074
      New Member
      • Dec 2007
      • 198

      #3
      Thankyou sir,

      My problem has been solved.

      Comment

      • idsanjeev
        New Member
        • Oct 2007
        • 241

        #4
        Originally posted by vikas251074
        Thankyou sir,
        My problem has been solved.
        glad you got it working.
        Regards
        Jha

        Comment

        • vikas251074
          New Member
          • Dec 2007
          • 198

          #5
          Excuse me sir,

          This method does not work for array type inputs text. Suppose, I have four rows for mat, cmp_sr_no, dept_sr_no, qty, wt, rem fields. The number of row is dynamic as per the requirement of user. When this page loads, the focus should be on first row of mat field. How can this be done?

          Thanks and regards,
          Vikas

          Comment

          • idsanjeev
            New Member
            • Oct 2007
            • 241

            #6
            Originally posted by vikas251074
            Excuse me sir,

            This method does not work for array type inputs text.When this page loads, the focus should be on first row of mat field. How can this be done?

            Thanks and regards,
            Vikas
            plese try to replce body tag with

            Code:
            <body onLoad="document.myform.mno[0].focus();">
            Jha

            Comment

            • vikas251074
              New Member
              • Dec 2007
              • 198

              #7
              Yes sir,
              I got it.

              Thanks and regards,
              Vikas

              Comment

              • idsanjeev
                New Member
                • Oct 2007
                • 241

                #8
                Originally posted by vikas251074
                Yes sir,
                I got it.
                Thanks and regards,
                Vikas
                Enjoy
                Happy Programming
                regards
                Jha

                Comment

                Working...