Easy one about web forms

  • Thread starter Thread starter Ann Smith
  • Start date Start date
A

Ann Smith

How do you set the focus to a text box on a web form? I
want it to go to different boxes depending on the answer
to a question.

Thanks
Ann
 
Hi Ann,
You need the .focus() method in Javascript to do this.

Marcie
 
Is it not possible to do it in VB then?
-----Original Message-----
Hi Ann,
You need the .focus() method in Javascript to do this.

Marcie



.
 
For web forms you have to set focus with client-side script. You can
emit the script from the server, with routines such as
RegisterStartupScript.

Marcie
 
Marcie,
For web forms you have to set focus with client-side script. You can
emit the script from the server, with routines such as
RegisterStartupScript.
However I never succeeded with this one, because it has to be absolute the
last on a page.

\\\
When this is your textbox (can as well be an ASP box it is the ID that
counts)
<INPUT tabindex="1" id="fieldid" type="text" size="27">

//This should be the last rows in your html aspx file

<script language="JavaScript">
document.all("fieldid").focus();
</script>
</HTML>
///

I hope this helps a little bit?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top