Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop focus movement in Firefox

Status
Not open for further replies.

hoss1524

Programmer
Apr 13, 2005
5
US
I’m new at this, especially with Firefox, so any help would be appreciated. I am trying to stop the focus from moving option to option within a form when using the arrow keys. Here is the code that I am currently using to do this:
document.onkeydown =
function () {
return false;
};

This seems to work fine in IE, but I need it to work in Firefox also. I was hoping someone could give me some insight on my problem. Thanks in advance for any advice.


Dan
 
from moving option to option"

what type of 'options' are these? textboxes, links, checkboxes, radio buttons, etc...?

and please explain a little better what you are trying to do...

thanks!

- g
 
They are actually options in a select box. Whats going on is, there are two select boxs. You can move items from one to the other by using the right and left arrow, onkeypress calls a function to do this. When you hit the up or down key it calls another function to move the option and the focus to stay with the moved option. It calls the function and the option moves but then the focus move again. Everything seems to work in IE when I use
document.onkeydown =
function () {
return false;
};
but is still jumping to the next option in FF. Hope that explains it a little better, and thanks again for any help.
 
Try attaching that onkeydown function to the select boxes themselves, rather than the document object. At the bottom of your page, put this:

Code:
document.forms['formName'].elements['selectName'].onkeydown = function() { return false; };

*cLFlaVA
----------------------------
[tt]a frickin' twelve-gauge, what do you think?[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Thanks for the response. I tried what you suggested and the focus still moved in FF.
 

I'm not sure that what you are asking can be done without making your own custom build of Firefox. I could, of course, be totally wrong on that, but after playing around for a while, nothing obvious seemed to work.

I guess the people behind the browser didn't think that turning off a feature that helps people to navigate was such a good idea - and I agree with that sentiment.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top