Common Code for Mouse / Video manipulation
|
| Mouse / Video code, which is common to many routines -- also include
Common Code
[Go Up to JavaScript index]
|
JavaScript
// Common Variables. These should be
included prior to the first execution of a subroutine, at the
top of the <body>
var
Xmouse = 0; // mouse position
var Ymouse = 0;
var isNetscape = navigator.appName=="Netscape";
|
|
// Common Style Settings, in the
<body>
if (document.all&&window.print)
document.body.style.cssText="overflow-x:hidden;overflow-y:scroll" |
|
// Common Timer and Event-Handling
routines, in the <body>
//
just save mouse position for animate() to use
function MoveHandler(e) {
Xmouse = e.pageX;
Ymouse = e.pageY;
return true;}// just save mouse position for animate() to use
function MoveHandlerIE() {
Xmouse = window.event.x + document.body.scrollLeft;
Ymouse = window.event.y + document.body.scrollTop;}
if (isNetscape) {
document.captureEvents(Event.MOUSEMOVE);
document.onMouseMove = MoveHandler;}
else {
document.onmousemove = MoveHandlerIE;} |
|