Subject: Set Focus
Posted By: topshed Post Date: 7/2/2005 1:28:51 AM
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
Reply By: dwithrow Reply Date: 7/2/2005 4:42:49 AM
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
Reply By: Imar Reply Date: 7/2/2005 7:06:00 AM
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.
Reply By: topshed Reply Date: 7/2/2005 10:01:39 AM
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

Reply By: dwithrow Reply Date: 7/2/2005 10:16:45 AM
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();'>

Reply By: topshed Reply Date: 7/2/2005 8:49:45 PM
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

Go to topic 32388

Return to index page 518
Return to index page 517
Return to index page 516
Return to index page 515
Return to index page 514
Return to index page 513
Return to index page 512
Return to index page 511
Return to index page 510
Return to index page 509