This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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
Author

how to handle the mouse scroll in javascript?

arulraj michealraj
Greenhorn

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?

or

is there any other solution?


Thanks,
Arulraj
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
Greenhorn

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

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

function change(form)
{

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

savePreviousReportParams(previousReportSelectedIndex);
var params = form.editableParam.value;

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

}
Eric Pascarello
author
Rancher

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

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to handle the mouse scroll in javascript?