473,804 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 19 '05 #1
6 4017
Using client-side script, not ASP, you can.

<body onload="documen t.nameofform.na meofinput.focus ();">

Ray at work

"Gonzosez" <tb***@hinklemf gNS.com> wrote in message
news:OA******** ******@TK2MSFTN GP11.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

Jul 19 '05 #2
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.pyobl ic.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

Jul 19 '05 #3
Gazing into my crystal ball I observed "Gonzosez" <tb***@hinklemf gNS.com>
writing in news:OA******** ******@TK2MSFTN GP11.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
Jul 19 '05 #4
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" <ar****@sbcglob al.net> wrote in message
news:Xn******** *************** *****@207.115.6 3.158...
Gazing into my crystal ball I observed "Gonzosez" <tb***@hinklemf gNS.com>
writing in news:OA******** ******@TK2MSFTN GP11.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

Jul 19 '05 #5
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.


Jul 19 '05 #6
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" <ar****@sbcglob al.net> wrote in message
news:Xn******** *************** *****@207.115.6 3.158...
Gazing into my crystal ball I observed "Gonzosez" <tb***@hinklemf gNS.com>
writing in news:OA******** ******@TK2MSFTN GP11.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

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4915
by: PeP | last post by:
Good morning, I have a form containing a text-area, I'd like to know if it exists a function that, when I activate an event, returns the position of the cursor in the text-area. For example, I write ten words in the text-area, then I move the cursor at the beginning of the second word and activate the event (for example, click on a button): is there a way to know that the cursor is at the beginning of the second word?
1
13166
by: Dan H. | last post by:
Hello, I want to try to retrieve the cursor position x and y relative to the form the cursor is over. The way I am doing it now is: 1. Retrieve the left and top position of the form relative to the desktop 2. Retrieve the desktop cursor position. 3. Take the difference of the forms left and top position. Adjust the desktop cursor position based on this.
1
5094
by: Tantra Veda | last post by:
Hello C# gurus, I have a question about finding cursor position in NumericUpDown control. On my form I have a numericUpDown control with 2 decimal places. I want to increment value in the numeric box by 1 if my cursor is in front of the decimal point. If the cursor is after the decimal point, I want to increment the value by 0.1. How do I accomplish this? Is there a way to find out the cusror position in the control relative to decimal...
1
3893
by: objectref | last post by:
Hi to all, we have the MousePosition property that we can get the Point of the position of the mouse cursor on the screen, but is it there a way to get the respective Point of a cursor in a TextBox ?? (relative to screen) I mean, i have a textbox that i write some text and i want to know the exact point location of the cursor at any time a character is displayed.
1
2393
by: Paul | last post by:
Hi all, I am making a DirectInput application wich must report correctly the cursor position in windowed mode (it means it has to be the same as Microsoft Window´s cursor position). First of all, I get Windows System Mouse Speed by using the function : SystemParametersInfo(SPI_GETMOUSESPEED, 0, &m_nMouseSpeed,0); After I am reading the last Windows cursor position with GetCursorPos. Then I read all mouse buffered data using...
22
4549
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't that difficult, but to find the next line is more difficult. For exemple: if my cursor is on line 200, it has to start searching on line 201, and not on line 1. Anybody has any ideas?
2
5784
by: tony | last post by:
Hello! Assume I catch a double click in a form by using the event handler that forms designer create for me. Now to my question when I double click in the form the event handler is trigged but when I'm in this event handler I want to find out the cursor position(x,y cordinates) where the double click occurred how is that done? //Tony
1
11978
by: jobs | last post by:
I'm trying to understand this and don't get it... I found some code that looks like it's going to work if I can make sense of how to position the div. The code displays a div with some data when I mouse over an element (A column in an ASP.NET Gridview, but I suppose that's not important) Everything works great, except I can't seem to position the div where I want given scrolling.
4
4678
by: Billy | last post by:
Hi all, I'm building a text file from a database table using the ASP Write Method and would like to position the cursor in a specific column position before writing the fields. As I loop through and write the fields into strings of rows, I want to be able to put field1 in row1/column position1, field2 in row1/column position10,.....etc. I've included the basic code to write a string of text. I understand the process of how to write the...
4
6979
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I just gotta fix it. I need to make some calculations on the measurements and VB6 is my language. Yes, the system mouse will corrupt the measurement, but it's an auditing function and that's acceptable.
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10350
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.