hem :quipy:
non ci sono parametri nella dichiarazione della funzione... viene usato l'oggetto arguments... quindi potresti fare così
codice:
function scroll() {
if (arguments.length < 4) {
strArg = arguments[0]
aA = strArg.split(',')
aA[0] = aA[0].replace(/["\']/,'')
}else{
var aA = arguments
}
var sD = aA[0]; if (sD == "") {return;}
var oD = eval("MM_findObj('" + sD + "')"); if (oD == null) {return;}
var iNX = parseInt(aA[1]), iNY = parseInt(aA[2]), iS = parseInt(aA[3]);
var iPx = (aA.length > 4) ? parseInt(aA[4]) : 0, iR = (aA.length > 5) ? parseInt(aA[5]) : 0;
var iT = 10, sS = ""; if (!document.layers) {oD = oD.style;} if (oD.tT != null) {clearTimeout(oD.tT);}
var iCX = parseInt(oD.left), iCY = parseInt(oD.top);
if (iR != 0) { // relative
if (iR == 1) {iNX = iCX - iNX; iNY = iCY;} // left
else if (iR == 2) {iNX = iCX + iNX; iNY = iCY;} // right
else if (iR == 3) {iNY = iCY - iNY; iNX = iCX;} // up
else {iNY = iCY + iNY; iNX = iCX;}} // down
var iX = iNX, iY = iNY; if ((iCX != iNX) || (iCY != iNY)) {
if (iPx > 0) { iT = iS;
var iPxX = iPx, iPxY = iPx, iMX = Math.abs(iCX - iNX), iMY = Math.abs(iCY - iNY);
if (iMX < iMY) {iPxY = (iMX != 0) ? ((iMY/iMX)*iPx) : iPx;}
else {iPxX = (iMY != 0) ? ((iMX/iMY)*iPx) : iPx;}
if (iPxX >= iMX) {iPxX = Math.min(Math.ceil(iPxX), iPx);}
if (iPxY >= iMY) {iPxY = Math.min(Math.ceil(iPxY), iPx);}
if ((iCX < iNX) && (iCX + iPxX < iNX)) {iNX = iCX + iPxX;}
if ((iCX > iNX) && (iCX - iPxX > iNX)) {iNX = iCX - iPxX;}
if ((iCY < iNY) && (iCY + iPxY < iNY)) {iNY = iCY + iPxY;}
if ((iCY > iNY) && (iCY - iPxY > iNY)) {iNY = iCY - iPxY;}}
else {var iMX = ((iNX - iCX) / iS), iMY = ((iNY - iCY) / iS);
iMX = (iMX > 0) ? Math.ceil(iMX) : Math.floor(iMX); iNX = iCX + iMX;
iMY = (iMY > 0) ? Math.ceil(iMY) : Math.floor(iMY); iNY = iCY + iMY;}
if ((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1) && (!window.opera)) {sS="px";}
if (iMX != 0) {eval("oD.left = '" + iNX + sS + "'");} if (iMY != 0) {eval("oD.top = '" + iNY + sS + "'");}
var sFunction = "scroll('" + sD + "'," + iX + "," + iY + "," + iS + "," + iPx + ",0)";
oD.tT = setTimeout(sFunction,iT);}
}