Helpful Information
 
 
Category: JavaScript programming
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

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

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

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.

Thank you.

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










privacy (GDPR)