473,382 Members | 1,302 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,382 software developers and data experts.

How to stop scroll wheel from selecting different menu options

I have a simple "quickbrowse" menu that does this:

<form>
<select name="quickbrowse" onchange="go(this)">
<option selected value="">go to a tool...</option>
<option value="#tool1">Great tool #1</option>
<option value="#tool2">Great tool #2</option>
<option value="#tool3">Great tool #3</option>
</select>
</form>

It calls this function:

function go(selection) {
var place = selection.value
// Ignore empty selection (default "pick a tool" choice)
if (place) {
location=place;
}
}

It works beautifully. However, in IE, after it goes to the new
location, if I turn the scroll wheel before clicking on anything, the
scroll wheel selects different options from the <select>, which makes
the browser jump to a totally different tool (section of the page). In
Firefox, it (correctly) scrolls up and down the text at the tool I had
originally selected.

I tried putting a document.focus() or a selection.blur() into the go
function, but they didn't seem to help.

Any thoughts?

Thanks,
-Amir Karger

Aug 15 '05 #1
6 3065
ASM
am********@gmail.com wrote:
I have a simple "quickbrowse" menu that does this:

<form>
<select name="quickbrowse" onchange="go(this)">
<option selected value="">go to a tool...</option>
<option value="#tool1">Great tool #1</option>
<option value="#tool2">Great tool #2</option>
<option value="#tool3">Great tool #3</option>
</select>
</form>

It calls this function:

function go(selection) {
var place = selection.value
var place = selection.selectedIndex.value
// would fix all your pbs
// Ignore empty selection (default "pick a tool" choice)
if (place) {
location=place;
}
if(place) location.href = place;
else alert('make an other choice');
}

It works beautifully. However, in IE, after it goes to the new
location, if I turn the scroll wheel before clicking on anything, the
scroll wheel selects different options from the <select>, which makes
the browser jump to a totally different tool (section of the page). In
Firefox, it (correctly) scrolls up and down the text at the tool I had
originally selected.

I tried putting a document.focus() or a selection.blur() into the go
function, but they didn't seem to help.

Any thoughts?

Thanks,
-Amir Karger

--
Stephane Moriaux et son [moins] vieux Mac
Aug 15 '05 #2
<am********@gmail.com> wrote
However, in IE, after it goes to the new
location, if I turn the scroll wheel before clicking on anything, the
scroll wheel selects different options from the <select>, which makes
the browser jump to a totally different tool (section of the page). In
Firefox, it (correctly) scrolls up and down the text at the tool I had
originally selected.

I tried putting a document.focus() or a selection.blur() into the go
function, but they didn't seem to help.


document.focus() is bogus. Try window.focus() instead. Or indeed
selection.blur(), if "selection" is a variable referencing the <select>
element. If it is, I 'd give it a less confusing name, as the term selection
has meaning already in some browsers.

hth
ivo
http://4umi.com/
Aug 15 '05 #3
McA
> It works beautifully. However, in IE, after it goes to the new
location, if I turn the scroll wheel before clicking on anything, the
scroll wheel selects different options from the <select>, which makes
the browser jump to a totally different tool (section of the page). In
Firefox, it (correctly) scrolls up and down the text at the tool I had
originally selected.


IE supports mouswheel event. It's normal behavior can be disabled by
returning false.

<select name="quickbrowse" onchange="go(this)" onmousewheel="return
false;">

Aug 15 '05 #4

Other wrote:
<am********@gmail.com> wrote
However, in IE, after it goes to the new
location, if I turn the scroll wheel before clicking on anything, the
scroll wheel selects different options from the <select>, which makes
the browser jump to a totally different tool (section of the page). In
Firefox, it (correctly) scrolls up and down the text at the tool I had
originally selected.

I tried putting a document.focus() or a selection.blur() into the go
function, but they didn't seem to help.


document.focus() is bogus. Try window.focus() instead. Or indeed
selection.blur(), if "selection" is a variable referencing the <select>
element. If it is, I 'd give it a less confusing name, as the term selection
has meaning already in some browsers.

hth

It h'ed. Btw, onmousewheel="returnfalse" was a neat solution, but then
the mousewheel wouldn't move up & down in the text of the window after
jumping. window.focus nicely puts the focus back in the window so the
scroll wheel works as expected.

Thanks for the quick response.

-Amir

Aug 15 '05 #5
am********@gmail.com wrote:
[...]


It h'ed. Btw, onmousewheel="returnfalse" was a neat solution, but then
the mousewheel wouldn't move up & down in the text of the window after
jumping. window.focus nicely puts the focus back in the window so the
scroll wheel works as expected.


What happens if you use arrow keys to go up or down the menu?
--
Rob
Aug 15 '05 #6
Arrow keys & return seem to work. Not that very many people will use
that, I expect.

-Amir

Aug 16 '05 #7

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

Similar topics

3
by: Devonish | last post by:
I have a form designed as a Continuous form which displays one record per line. Taking account of the header and footer and the size of the screen, I can display 30 records at a time. I can see...
1
by: Otie | last post by:
Can this be fixed? I have a combo box which is filled with lots of choices on a certain form. I click on the combo box and want to scroll down through the items using my mouse's scroll wheel....
2
by: web1110 | last post by:
Hi y'all, Ok, still playing with my DataGrid ComboBox. I solved the scroll problem, but now I discovered this: If I am in the ComboBox and rotate the scroll wheel on the mouse, I get the...
0
by: web1110 | last post by:
Hi y'all, I have written a ComboBox derived from DataGridTextBoxColumn to use in a DataGrid. It seems to be working ok, however... When the ComboBox is displayed, the mouse scroll wheel...
2
NeoPa
by: NeoPa | last post by:
This may well only work in Office 2003 but may be worth trying for earlier versions. The article I found (Add support for the scroll wheel to the Microsoft Visual Basic for Applications 6...
1
by: ykhamitkar | last post by:
Hi there, I have created one ms access form which based on a table. Now when I use scroll wheel of my mouse on the form it automatically changes records. How can I disable scroll wheel ...
2
by: Keith Wilby | last post by:
Why has my scroll wheel suddenly started working in a VBA module window? I'm quite happy that it finally does work but am not aware of why. Any offers? Keith.
2
by: =?Utf-8?B?TWFyaw==?= | last post by:
Does anyone know of a way to disable the mouse scroll wheel when a control such as a combobox or listbox has focus? I ask this, because I have an extremely large data entry form with vertical...
5
by: dantebothermy | last post by:
I've got a patient enrollment application (functionally similar to a customer/order entry application). My problem comes when users accidentally hit the scroll wheel -- it can take them to a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.