Set Focus Command

S

Steve Renier

How is it possible to have the cursor set in a form field when the form
opens? I have form with a field, which is used for a search term entry. I
want the focus on this field with the cursor already placed in it when the
form opens.
 
K

Kevin Spencer

JavaScript:

<script type="text/javascript"><!--
document.forms[0].txtFoo.focus();
// --></script>

Note that this is an example. Substitute the name of your text box for
"txtFoo".
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
M

Murray

<body onLoad="javascript:document.forms[0].txtFoo.focus()"

works too....

--
Murray

Kevin Spencer said:
JavaScript:

<script type="text/javascript"><!--
document.forms[0].txtFoo.focus();
// --></script>

Note that this is an example. Substitute the name of your text box for
"txtFoo".
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

Steve Renier said:
How is it possible to have the cursor set in a form field when the form
opens? I have form with a field, which is used for a search term entry. I
want the focus on this field with the cursor already placed in it when
the
form opens.
 
Top