How to set first focus on specific textbox?

O

Onin Tayson

Hi ABC,

you can use the <body>'s onload event. i.e.

<body onload="javascript: document.form1.TextBox1.focus();">

HTH,
 
L

Leon Mayne [MVP]

ABC said:
How to set first focus on specific textbox?

You can do it with javascript. Make sure your form tag has a name attibute,
e.g. for the example below name="userform"

<script language="javascript" type="text/javascript">
<!--
document.userform.textboxname.focus();
//-->
</script>

You can't do it with server-side code though.
 
B

bienwell

Hi,

How can we focus on the field after the form validation. For example, user
enter wrong data type on the field after validation
(RegularExpressionvalidator), and I'd like to focus on that field again ???

=======================================================
 

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

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top