|
-
Sep 7th, 2000, 01:07 PM
#1
Can anyone let me know how to set focus to the first field on an Active server page?
I guess the following code can be used
theForm.fieldname.focus() 'java script
can be used but I am not sure where to invoke this.
Thanks.
-
Sep 7th, 2000, 01:28 PM
#2
Frenzied Member
I can't remember the JavaScript to do it, so I can't really comment on that statement. You could use VBScript though, I'm pretty sure, just use theFormName.fieldName.SetFocus.
This is client-side, not server side, so you need to either add this code to the very end of the page, or put the code in a sub and call it whenever you need to. It shouldn't be that hard I think.
Harry.
"From one thing, know ten thousand things."
-
Sep 8th, 2000, 11:04 AM
#3
here is the code:
function window_onload(theForm) {
theForm.AppNum.focus();
}
If I add an alert message before and after the focus statement, i get just the first message. And it doesnt give me an error message.
(By the way this is a client side script).
IF this code should not be placed in the windows on load event, is there some other event where it can be placed. My only requirement is when the page is displayed, the first field should receive focus.
Could anyone tell me whats wrong.
Thanks.
-
Sep 8th, 2000, 11:33 AM
#4
Frenzied Member
Perhaps the window_onload event occurs before the page is displayed, and the object AppNum hasn't been instantiated yet. Try adding the code to the end of the HTML if you can, see if that's any better.
Harry.
"From one thing, know ten thousand things."
-
Sep 8th, 2000, 11:43 AM
#5
Thanks Harry.
Apparently if this is placed after the HTML code, it is executed even before windows onload.
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
|