It's not a secret anymore!*
The moose likes HTML, CSS and JavaScript and the fly likes how to handle the mouse scroll in javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to handle the mouse scroll in javascript?" Watch "how to handle the mouse scroll in javascript?" New topic

how to handle the mouse scroll in javascript?

arulraj michealraj

Joined: Mar 02, 2005
Posts: 28
Hi guys,

I have some doubt regarding of javascirpt.

I created drop-down list like <select onchange="change()"><option>ddf</option>.......</select>.

I hit the DB and get the appropriate data when i change the value in drop-down list. Once the value in drop-down list is selected, i load the jsp page.

Here the problem is that if i select a value in drop-down list and then scroll the mouse, selected values are changing by scrolling the mouse.
So that, it loads same jsp page multiple times by scrolling the mouse.

How to handle mouse scroll in javascript?


is there any other solution?

Pratik Lohia
Ranch Hand

Joined: May 05, 2005
Posts: 88
The problem I think should be with the javascript method you are calling on change of value in the drop down.

Since your page refreshes on change of value in the drop down(This refresh should happen the instant the value in the drop down is changed), is there a considerable time gap between the value selection of the value in the drop down and the submit, that gives the user time to scroll the mouse, before the page is submitted?

If yes, then try to optimise your javascript method, as it might be perfroming some looping functions that cause delay in the submit process after the value in the drop down is changed..

PS: You may want to put up the code of the javascript method, to help evaluate where the problem lies
arulraj michealraj

Joined: Mar 02, 2005
Posts: 28
Here i included the javascript method

<select name="report"><option>dfd</option>.....</select>

function change(form)

var report =;
reportSelectedIndex = report.selectedIndex;
var selectedReportValue = report.options[reportSelectedIndex].value;

var params = form.editableParam.value;

selectedFunctionID = selectedReportValue.substring(0, selectedReportValue.indexOf("$"));
//It is for exception Report which will be shown in Tabbed Menu.
//check the status of report whether it is standard or Exception Reports
if(exceptionStatus==false || report.selectedIndex==0)
this.location ="reportv2.jsp?FUNCTION_IDS="+selectedFunctionID+"&EXCEPTION_TYPE_LIST="+form.EXCEPTION_TYPE_LIST.value;
return ;
getForm().report.selectedIndex = reportSelectedIndex;
getForm().editableParam.value = params;
previousReportSelectedIndex = reportSelectedIndex;

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
That is the defualt behavior of the scrollwheel on a selection list and there is really nothing that you can do.

I agree. Here's the link:
subject: how to handle the mouse scroll in javascript?
Similar Threads
How to set Default selection in h:selectOneMenu
Font color in drop down menu
Replacing the drop down box to text field
Advanced selection in a drop-down list
Strut-Ajax - display states when Country selected