|
-
Sep 17th, 2003, 09:58 AM
#1
Thread Starter
Lively Member
Setting the default focus on a web control
Please forgive what seems to me a very simple question, but, in VB6 I know how to set the default focus on a specific control when the page starts up. However, how do I do this on an ASP.net page? I have tried all the properties I can think of and I just can not get it to work. I have looked in all the books I have and nothing on "focus". Please help.
-
Sep 17th, 2003, 11:01 AM
#2
PowerPoster
Well, I don't know of ASP.Net way, but Javascript works fine. If you need to know how to do it, check out www.google.com. They make the focus go to the textbox when the page loads through Javascript. Here is their function:
Code:
<script>
<!--
function sf(){document.f.q.focus();}
// -->
</script>
<body onLoad=sf()>
Just to note, f is the name of the form, and q is the textbox.
-
Sep 17th, 2003, 11:12 AM
#3
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|