Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   cursor in position (http://www.velocityreviews.com/forums/t790338-cursor-in-position.html)

Gonzosez 09-19-2003 12:42 PM

cursor in position
 
When a page is opened is there a way to set focus of the cursor to a named
input.
I want the cursor to be in the input box when the page is opened.
Thanks



Ray at 09-19-2003 12:51 PM

Re: cursor in position
 
Using client-side script, not ASP, you can.

<body onload="document.nameofform.nameofinput.focus();">

Ray at work

"Gonzosez" <tbyam@hinklemfgNS.com> wrote in message
news:OAoF7uqfDHA.2576@TK2MSFTNGP11.phx.gbl...
> When a page is opened is there a way to set focus of the cursor to a named
> input.
> I want the cursor to be in the input box when the page is opened.
> Thanks
>
>




Bob Barrows 09-19-2003 12:55 PM

Re: cursor in position
 
Gonzosez wrote:
> When a page is opened is there a way to set focus of the cursor to a
> named input.
> I want the cursor to be in the input box when the page is opened.
> Thanks


This is a client-side coding question which is off-topic for this newsgroup
(ASP is server-side technology). In the future please direct your
client-side questions to a newsgroup with DHTML in its name, or to one of
the microsoft.pyoblic.scripting newsgroups.

To answer your question, set the id property of the input and then put the
following line of code in the window_onload event:

inputid.focus

HTH,
Bob Barrows




Adrienne 09-19-2003 06:03 PM

Re: cursor in position
 
Gazing into my crystal ball I observed "Gonzosez" <tbyam@hinklemfgNS.com>
writing in news:OAoF7uqfDHA.2576@TK2MSFTNGP11.phx.gbl:

> When a page is opened is there a way to set focus of the cursor to a
> named input.
> I want the cursor to be in the input box when the page is opened.
> Thanks
>
>


You might want to think twice about wanting to do this. If someone is on a
slow connection, and the page has partially loaded, they might start
filling out the form, get two fields completed, then suddenly, they are
back to field 1, but they are still typing info for field 3.

--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com

Ray at 09-19-2003 06:20 PM

Re: cursor in position
 
Good point. My web banking login page does that, and not only does it set
focus, it also executes a form.reset(); which irritates me beyond belief.
I'm on a fast connection, but their servers are ungodly slow. They have 7
NT servers for 630 banks. Unacceptable.

Ray at work

"Adrienne" <arbpen@sbcglobal.net> wrote in message
news:Xns93FB709507A2Aarbpenyahoocom@207.115.63.158 ...
> Gazing into my crystal ball I observed "Gonzosez" <tbyam@hinklemfgNS.com>
> writing in news:OAoF7uqfDHA.2576@TK2MSFTNGP11.phx.gbl:
>
> > When a page is opened is there a way to set focus of the cursor to a
> > named input.
> > I want the cursor to be in the input box when the page is opened.
> > Thanks
> >
> >

>
> You might want to think twice about wanting to do this. If someone is on

a
> slow connection, and the page has partially loaded, they might start
> filling out the form, get two fields completed, then suddenly, they are
> back to field 1, but they are still typing info for field 3.
>
> --
> Adrienne Boswell
> Please respond to the group so others can share
> http://www.arbpen.com




PB4FUN 09-19-2003 06:42 PM

Re: cursor in position
 
It is possible to escape that one.
Put the form in a layer that is set to not visible.
After the page has loaded set the layer to visible again.

Meindert, MCP

> > When a page is opened is there a way to set focus of the cursor to a
> > named input.
> > I want the cursor to be in the input box when the page is opened.
> > Thanks
> >
> >

>
> You might want to think twice about wanting to do this. If someone is on

a
> slow connection, and the page has partially loaded, they might start
> filling out the form, get two fields completed, then suddenly, they are
> back to field 1, but they are still typing info for field 3.
>





WIlliam Morris 09-19-2003 07:06 PM

Re: cursor in position
 
I get this a lot in a web application I've written for my company. Just
about EVERY page is some sort of data entry page, and (of course) everyone
wants the focus placed when the page loads.

I get around this by putting all of my javascript at the END of the page,
rather than in the <head> section, with the last line of script being the
..focus() line. That way, the page and all of its elements have completely
loaded before any client-side instructions are executed. This has the added
benefit of cutting way way back on "object required" and "not found" errors.

Some of the pages are huge, and involve mind-numbingly lengthy client-side
validation scripts. When I inherited the application, those scripts were
scattered all over the page. What I do now is declare a server-side array
at the top of the page, adding the client-side function code to it as the
page builds (each element gets a function or discrete instruction), then as
a last step write the SCRIPT tag, loop the array writing all the javascript,
then close the script.

- Wm "It may be wrong but you wanted it fast" Morris

--
William Morris
Product Development, Seritas LLC

"Adrienne" <arbpen@sbcglobal.net> wrote in message
news:Xns93FB709507A2Aarbpenyahoocom@207.115.63.158 ...
> Gazing into my crystal ball I observed "Gonzosez" <tbyam@hinklemfgNS.com>
> writing in news:OAoF7uqfDHA.2576@TK2MSFTNGP11.phx.gbl:
>
> > When a page is opened is there a way to set focus of the cursor to a
> > named input.
> > I want the cursor to be in the input box when the page is opened.
> > Thanks
> >
> >

>
> You might want to think twice about wanting to do this. If someone is on

a
> slow connection, and the page has partially loaded, they might start
> filling out the form, get two fields completed, then suddenly, they are
> back to field 1, but they are still typing info for field 3.
>
> --
> Adrienne Boswell
> Please respond to the group so others can share
> http://www.arbpen.com





All times are GMT. The time now is 02:59 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57