| windandwaves 2007-07-12, 10:18 pm |
| Hi Folk
How can I rewrite the function below so that it works. Problem is I
can't get the functions assigned properly to the al element.
What am I doing wrong?
var buttonNames = new Array("", "plus", "minus","left", "up", "down",
"right", "reset" );
var buttonsOn = new Array();
var buttonFunction = new Array("", "zoom", "zoom", "scroll", "scroll",
"scroll", "scroll", "");
var buttonLowSpeed = new Array(99, 3, 3, -3, -3, 3, 3, 99);
var buttonHighSpeed = new Array(99, 9, 9, -9, -9, 9, 9, 99);
var buttonDirection = new Array(99, 1, -1, 0, 1, 1, 0, 99 );
for(var i = 1; i < 8; i++ ) {
buttonsOn[i] = 0;
overButtonNames[i] = 'i/' + buttonNames[i] + "O.gif";
outButtonNames[i] = 'i/' + buttonNames[i] + ".gif";
overButtons[i] = new Image();
overButtons[i].src = overButtonNames[i];
outButtons[i] = new Image();
outButtons[i].src = outButtonNames[i];
if(i < 7) {
var al = document.getElementById("a" + buttonNames[i]);
al.onclick = function () {return false;}
al.onmousedown = function(){buttonFunction[i] + "(" +
buttonHighSpeed[i] + ", " + buttonDirection[i] + ",0," + i + ");"}
al.onmouseover = function() {buttonFunction[i]
( buttonLowSpeed[i],buttonDirection[i],0,0);}
al.onmouseup = function() {"stop(" + i + ");";}
al.onmouseout = function () {"stop(" + i + ");";}
}
}
|