Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

focus on textbox

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
hello I have a problem with focus on a textbox. I have the following code in ASP

<form action=&quot;opslaan.asp&quot; method=&quot;post&quot; name=&quot;formtest&quot;>
<%
While (Not oRS9.EOF)
teller = teller + 1
Response.Write (&quot;<input type=text name=textfield&quot; & teller & &quot; value ='' size = 15 disabled>&quot;)
%>


now I want to get the focus on lets say: textfield2 (or whatever) I know it's something like:
document.formtest.textfield2.focus()

but this doesn't work, I think it's because I use name=textfield&quot;&teller ... can someone help me?
 
try naming it textfield&quot; & cstr(teller) &...

either that, or you can refer to it ordinally like

document.formtest.elements[2].focus();

^^
I **think** that's the syntax to refer to it that way -- you may have to modify it a bit --

:)
Paul Prewett
 
oké, I found the problem, now I just nead to solution:

I have several fields, when I push on the tab-key to go to the next field, this line doesn't work:
document.formtest.textfield2.focus()
but when I push with my mouse in another field the line works ... so it got something to do with the tab-key ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top