File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to handle the mouse scroll in javascript?

 
arulraj michealraj
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic