Give text box focus

A

Andy G

I have a login in screen with a username text box. How can I give focus to
that box when the screen is loaded? I have the following code entered
already but am not getting a scripting error but also am not getting the
blinking cursor in the box when loaded.

<script lanuage= jscript for="BRM\TestLogin" event="onload">
window.document.forms["TestLogin"].children["txtTESTUserName"].focus();
</script>

BRM is sublevel of project (name of project is CFSPH) and TestLogin is name
of web form. txtTESTUserName is the ID of my text box.

Thanks.
 
R

Ryan Walberg, MCSD for .NET

Andy said:
I have a login in screen with a username text box. How can I give focus to
that box when the screen is loaded? I have the following code entered
already but am not getting a scripting error but also am not getting the
blinking cursor in the box when loaded.

<script lanuage= jscript for="BRM\TestLogin" event="onload">
window.document.forms["TestLogin"].children["txtTESTUserName"].focus();
</script>

BRM is sublevel of project (name of project is CFSPH) and TestLogin is name
of web form. txtTESTUserName is the ID of my text box.

Thanks.

<body
onLoad="document.forms['TestLogin'].elements['txtTESTUserName'].focus();">
 

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,770
Messages
2,569,586
Members
45,089
Latest member
Ketologenic

Latest Threads

Top