Web Analytics Made Easy -
StatCounter Re: Force TAB key in javascript - CodingForum

Announcement

Collapse
No announcement yet.

Re: Force TAB key in javascript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Re: Force TAB key in javascript

    I am working on a asp program where input boxes are created dynamically. These input boxes have maximum of just 1 char.
    ie. just one char allowed per input box.

    I need a script for automatically putting the cursor to next input box on keying some value to input. How can i do this?

    sridhar

  • #2
    Show us how the boxes are written out so we can show you the easiest way to implement it.

    Comment


    • #3
      the code used by me

      I have used the following code in asp:

      <%y=rs1("Word1_Position")%>
      for i=1 to len(y)
      if mid(y,i,1) = "*" then%>
      <input type="text" taborder=<%=i%> name="T1<%=i%>" size="1" maxlength="1" style="border-style: solid; border-color: #FF0000" >

      <%else%>
      <input type="text" taborder=<%=i%> name="T1<%=i%>" size="1" maxlength="1" style="border-style: solid; border-color: #000000" >
      <%end if
      next%>

      All the inputs of maxlength1. What i want is to move to the next taborder automatically once the current input is filled.

      sridhar

      Comment


      • #4
        You could try something like this:

        <input type="text" taborder=<%=i%> name="T1<%=i%>" onkeyup="document.FormName.T1<%=i+1%>.focus()" size="1" maxlength="1" style="border-style: solid; border-color: #FF0000" >

        Be sure to replace FormName with the name of your form.

        Comment


        • #5
          Thank you.

          Comment


          • #6
            Your suggession works well - as long as TAB / SHIFT+TAB is not used.

            When i use Tab, it goes forward twice and shift+tab does not stay at previous tab order- moves to next tab order.

            any way to overcome?

            sridhar

            Comment

            Working...
            X