473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Easy one about web forms


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
Nov 21 '05 #1
4 931
Hi Ann,
You need the .focus() method in Javascript to do this.

Marcie

On Tue, 12 Apr 2005 07:33:30 -0700, "Ann Smith"
<an*******@discussions.microsoft.com> wrote:

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


Nov 21 '05 #2
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

On Tue, 12 Apr 2005 07:33:30 -0700, "Ann Smith"
<an*******@discussions.microsoft.com> wrote:

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


.

Nov 21 '05 #3
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

On Tue, 12 Apr 2005 08:00:28 -0700, "Ann Smith"
<an*******@discussions.microsoft.com> wrote:
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

On Tue, 12 Apr 2005 07:33:30 -0700, "Ann Smith"
<an*******@discussions.microsoft.com> wrote:

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


.


Nov 21 '05 #4
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
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
1
by: Chris | last post by:
Our company developed the last couple of years a development tool: using this tool we configure and program (using SQL, and Java-Script) very, very easy an application. The output of the effort is...
4
by: Steve B. | last post by:
How do I reference a WinForm file (i.e. Class) in Project B from a WinForm file in Project A? I've previously used Tutorial: Creating C# Class Library (DLL) Using Visual Studio .NET...
5
by: AC | last post by:
Any reason i'm having trouble with: DataGrid1.Columns(7).ItemStyle.HorizontalAlign = HorizontalAlign.Right I'm trying to directly set the column alignment of a datagrid created at runtime.. ...
7
by: Trev | last post by:
Hey, I just want to know (i know i should know this) how can i show up another form? I have 2 forms and the first one has a button on it that when i click the button i want the second form to...
0
by: James Allen Bressem | last post by:
Do drag n drop in VB.Net in ten lines of code - (too easy) I was searching through the MSDN documentation trying to figure out how to do drag n drop and I found a sample program. The sample...
2
by: kaosyeti | last post by:
it may be because i'm having a BAD day but i can't come up with an easy way to do this... i want to have a form for recording one department's yearly forecasted data. what i have is a column of...
7
by: EJ | last post by:
var theSel = document.forms.elements; this doen't seem to work var cpus = document.forms.elements; var cpusx = cpus.options.value; var cpusxd = cpusx.slice(8,10); when I use the event...
2
by: Cheryl.D.Monroe | last post by:
Hi all, I need help on something that seems like it should be easy to do. When entering new data onto any form in my database the field has to exist in another table (tblPatients). If a SubNo...
10
by: erokar | last post by:
Which tools would you use? I want the interface design to be as easy and fast as possible, all ideology aside. I'm considering either IronPython+Visual Studio or Python+Qt -- but I'm open for other...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.