Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 2nd, 2005, 01:28 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default Set Focus

I am having a problem with Classic ASP, I want to set focus to the starting form at the top of the script

There appears to be lots of information on how to do it with .NET, but I don't use it just basic ASP

Can anyone point me in the right direction please

Thanks

Topshed :)
 
Old July 2nd, 2005, 04:42 AM
Registered User
 
Join Date: Mar 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dwithrow Send a message via Yahoo to dwithrow
Default

Topshed,

There are a lot of things you need/want to do with a web page that APS can't do. That's why you need a good working knowledge of javascript and HTML to get everything to work well. Focus is a good example. ASP.NET takes care of this handily, but not ASP.

If all you want to do is set the focus to a particular form field when the page is rendered, do it in the <body> tag with 'onload'. Example:
<body onload='document.frmLogin.username.focus();'>

HTH,
Don
 
Old July 2nd, 2005, 07:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:Focus is a good example. ASP.NET takes care of this handily, but not ASP.
Can you give an example how ASP.NET takes care of that??

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 2nd, 2005, 10:01 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Originally posted by dwithrow
If all you want to do is set the focus to a particular form field when the page is rendered, do it in the <body> tag with 'onload'. Example:
<body onload='document.frmLogin.username.focus();'>

Yes I am aware of the need to learn Java but dont I need a small scxript to utilise <body onload='document.frmLogin.username.focus();'>
in Vanilla ASP

Thanx
Topshed
 
Old July 2nd, 2005, 10:16 AM
Registered User
 
Join Date: Mar 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dwithrow Send a message via Yahoo to dwithrow
Default

No need for any script. You're executing focus() from the onload property of the page body. Just make sure you have a form and controls on that form -
<body onload='document.<your form name>.<your input text box>.focus();'>

 
Old July 2nd, 2005, 08:49 PM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dwithrow
 No need for any script. You're executing focus() from the onload property of the page body. Just make sure you have a form and controls on that form -
<body onload='document.<your form name>.<your input text box>.focus();'>
Thanks a lot that fixed it without all the Java stuff

Great stuff

topshed:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set focus to a RadioButtonList? binici ASP.NET 2.0 Basics 0 March 2nd, 2007 08:03 PM
set focus sameer_1981 Intro Programming 1 February 27th, 2007 09:14 AM
set focus akibaMaila VB.NET 2002/2003 Basics 1 July 12th, 2005 05:56 PM
Set focus question crisan Access VBA 4 March 25th, 2005 09:38 PM
how to set focus waley .NET Web Services 1 May 25th, 2004 02:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.