473,473 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Detecting Tab Key Help Needed

I'm trying to use JS to move the cursor from my user login text field
to the password text field - I've put the onKeyPress() event in the
user input tag but then I press the Tab key the cursor doesn't move -
can someone please help me with this? Thanks...

function detect_tab_key()
{
var key_code = window.event.keyCode;
if (key_code == 9)
{
document.forms[0].frm_password.focus();
document.forms[0].frm_password.select();
}
}

Jul 20 '05 #1
1 7636
VK
Tab key is a "system button". It means that you cannot reprogram it, the
default system behavior will always override your script (the same way the
F1 key always returns browser help, no matter what action did you attach to
this).

Solution are:
1. Simply place login and password one after another in the form. It will
give you the same effect without any programming.
2. If your form layout ABSOLUTELY requires to put some extra stuff between
these fields, than use TABINDEX property (IE 4.x and higher):

<input name="field1" ... tabindex="1">
<input name="field2" ... tabindex="3">
<input name="field3" ... tabindex="2">

Being on field1, on tab press the focus will jump on field3 first
Ralph Freshour <ra***@primemail.com> wrote in message
news:04********************************@4ax.com...
I'm trying to use JS to move the cursor from my user login text field
to the password text field - I've put the onKeyPress() event in the
user input tag but then I press the Tab key the cursor doesn't move -
can someone please help me with this? Thanks...

function detect_tab_key()
{
var key_code = window.event.keyCode;
if (key_code == 9)
{
document.forms[0].frm_password.focus();
document.forms[0].frm_password.select();
}
}

Jul 20 '05 #2

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

Similar topics

4
by: Doug van Vianen | last post by:
Hi, I am working on an Applet which provides some mouse practice for new computer users in our local seniors' computer club. The applet contains several cards, in a card layout, which are...
5
by: Jole | last post by:
Hi I'm writing a program that needs to read from a file. In order for the program to be robust, it should somehow check that the file isn't corrupt, or stuffed in any way. For example, that...
15
by: Jay | last post by:
I'm sure this is a really dumb question, but how do you detect a variable type in Python? For example, I want to know if the variable "a" is a list of strings or a single string. How do I do...
3
by: Holden Caulfield | last post by:
Does anyone know how to detect if a user has pasted code using the right mouse button into a textarea? I have fields in a form that autoupdate when text is changed in a textarea, but if it is...
7
by: fox | last post by:
Maybe this is not the best group to ask this question, but I don't know a better one. I'm looking for a *portable* program in C (I mean source code) to detect whether unaligned word access is:...
1
by: Paul W | last post by:
I'm having trouble detecting whether my Control is in DesignMode. I'm deriving a class from TreeView; Public Class ExplorerView Inherits TreeView ... End Class
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
9
by: timor.super | last post by:
Hi group, I've written a client/server application, using the dotnet sockets. In my server, I have a thread waiting for messages with : ret = currSocket.Receive(buffer, 1024,...
15
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is...
44
by: Pilcrow | last post by:
Is there a way that a proram can detect whether it is operating in an ASCII or an EBCDIC environment?
0
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...
0
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,...
0
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...
0
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.