Hi all
I am having a problem with an if statement. It is for an auto scroll depending on where the mouse pointer is on the screen. The problem is that it is not doing anything and not giving any error message either.
the variables winH stands for Window Height, winW stands for Window width.
[COLOR=limegreen]
// the following is for vertical scroll
var autoScrollOk = true; // when the push button “autoscroll on” is pressed autoScrollOk
// will be changed to true ( I have not put this button in yet)
//If autoScrollOk = true then it will autoscroll
//if ( autoScrollOk = true ) {
[COLOR=darkblue]if[COLOR=blue] window.event.y < winH / 3 [COLOR=limegreen]// if the mouse is on the top 1/3 of screen
[COLOR=firebrick]window.scrollBy(0,-4);[COLOR=limegreen]// the window will scroll up
}
[COLOR=darkblue]else[COLOR=blue] window.event.y > [COLOR=blue]winH / 3 [COLOR=blue]* 2 [COLOR=limegreen]// if the mouse is on the lower 3/3 of screen
[COLOR=firebrick]window.scrollBy(0,4);[COLOR=limegreen]// the window will scroll down
}
[COLOR=limegreen]//end vertical scroll
//Start horizontal scroll
[COLOR=darkblue]if[/COLOR] ( [COLOR=blue] window.event.x < winW / 3 [/COLOR]) { [COLOR=limegreen]// if the mouse is on the left 1/3 of screen[/COLOR]
[COLOR=firebrick]window.scrollBy(-4,0);[/COLOR] [COLOR=limegreen]// the window will scroll left[/COLOR]
}
[COLOR=darkblue]else[/COLOR] ( [COLOR=blue] window.event.x >[/COLOR] ( [COLOR=blue]winW / 3 [/COLOR]) [COLOR=blue]* 2 [/COLOR]) { [COLOR=limegreen]// if the mouse is on the Right 3/3 of screen[/COLOR]
[COLOR=firebrick]window.scrollBy(4,0);[/COLOR] [COLOR=limegreen]// the window will scroll Right[/COLOR]
}
[COLOR=limegreen]//End horizontal scroll[/COLOR]
[COLOR=limegreen]//End If autoScrollOk = true then it will autoscroll[/COLOR]
}[COLOR=limegreen]//End function
I have just tried:
[COLOR=darkblue]if[COLOR=blue]window.event.y < [COLOR=blue] winH / 3
but that does not work either.
Please keep technical terms to a minimum because I am a beginner at JavaScript.
I would be grateful for any help offered. Thanks