473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to prevent tab key from causing tabbing to the tool bars in IE and Firefox

Sorry for the long title.

How does one prevent a tab key press from causing the focus to leave a page and
move to the navigation bar and tool bars in a browser?

I've set the TabIndex on all of the controls on the page, but as soon as I hit
the tab key the focus jumps to the nav control in IE or Firefox.

Thanks,
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Jan 14 '07 #1
2 3566
Hi,

Otis Mukinfus wrote:
Sorry for the long title.

How does one prevent a tab key press from causing the focus to leave a page and
move to the navigation bar and tool bars in a browser?

I've set the TabIndex on all of the controls on the page, but as soon as I hit
the tab key the focus jumps to the nav control in IE or Firefox.

Thanks,
Good luck with your project,

Otis Mukinfus
If the first and last "tab-enabled" objects on the page are controls
(and not links), you can use the following JavaScript (for example):

(first control on the page)

<input type="text" id="tfFirst" ... />

(last control on the page)
<input type="button"
onblur="document.getElementById('tfFirst').focus() ;" ... />

I looked for something similar for links, but I cannot find anything for
the moment. Though in theory links also support onblur and focus, I
can't seem to make it work in IE.

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 14 '07 #2
On Sun, 14 Jan 2007 16:44:56 +0100, "Laurent Bugnion [MVP]"
<ga*********@bluewin.chwrote:

At bottom...
>Hi,

Otis Mukinfus wrote:
>Sorry for the long title.

How does one prevent a tab key press from causing the focus to leave a page and
move to the navigation bar and tool bars in a browser?

I've set the TabIndex on all of the controls on the page, but as soon as I hit
the tab key the focus jumps to the nav control in IE or Firefox.

Thanks,
Good luck with your project,

Otis Mukinfus

If the first and last "tab-enabled" objects on the page are controls
(and not links), you can use the following JavaScript (for example):

(first control on the page)

<input type="text" id="tfFirst" ... />

(last control on the page)
<input type="button"
onblur="document.getElementById('tfFirst').focus( );" ... />

I looked for something similar for links, but I cannot find anything for
the moment. Though in theory links also support onblur and focus, I
can't seem to make it work in IE.

HTH,
Laurent
Laurent,

I found the solution: Here is a sample:
CountryDropDownList.Attributes.Add("onkeydown", "if(event.which ||
event.keyCode)" +
"{if ((event.which == 9) || (event.keyCode == 9)) " +
"{document.getElementById('" + LatitudeTextBox.ClientID +
"').focus();return false;}} else {return true}; ");

LatitudeTextBox.Attributes.Add("onkeydown", "if(event.which ||
event.keyCode)" +
"{if ((event.which == 9) || (event.keyCode == 9)) " +
"{document.getElementById('" + LatitudeDropDownList.ClientID +
"').focus();return false;}} else {return true}; ");
What it amounts to is hijacking the tab keystroke.

Thanks for trying to help. I appreciate it!

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Jan 14 '07 #3

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

Similar topics

1
by: windandwaves | last post by:
Hi Folk I am building an access application and one thing that I am having trouble with is menu bars, tool bars and other start-up procedures. What I want is hide all the menu bars and...
16
by: MLH | last post by:
If I give someone a runtime app, they can open the database window by pressing the F-11 key. How to prevent???
7
by: Xah Lee | last post by:
Look at this page http://xahlee.org/emacs/wrap-url.html Look at it in Firebox, look at it in Safari, in Opera, and look at it in Microsoft Internet Explorer. The only fucked up case, is...
10
by: Xah Lee | last post by:
Look at this page http://xahlee.org/emacs/wrap-url.html Look at it in Firebox, look at it in Safari, in Opera, and look at it in Microsoft Internet Explorer. The only fucked up case, is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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,...

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.