R
Rabel
Hi I am updating some pages from a website that is a few years old and
I didnt work on the site then, but the javascript works in ie but not
in firefox. The scripting is
function yyLayerScroll(daTarget, delay, ex, ey, dx, dy, sx, sy, daT,
daLoop, daFirst ) {
var yyX; var yyY; var target = MM_findObj(daTarget);
if(!target.oritop){
target.oritop = (document.layers)?target.top:target.style.top;
target.orileft = (document.layers)?target.left:target.style.left
}
if (document.layers) {
var ct = target.clip.top; var cb = target.clip.bottom; var cl =
target.clip.left; var cr = target.clip.right;
yyY=Math.abs(Math.round((ct-ey)/sy)); dy=Math.round(-(ct-ey)/yyY);
yyX=Math.abs(Math.round((cl-ex)/sx)); dx=Math.round(-(cl-ex)/yyX);
if(yyX<1){dx=0}else{yyX--}; if(yyY<1){dy=0}else{yyY--};
var t = target.top; var l = target.left;
target.clip.top = ct + (dy); target.clip.bottom = cb +
(dy);target.top = t - (dy);
target.clip.left = cl + dx;target.clip.right = cr + dx; target.left
= l - dx;
}else if ((document.all||document.getElementById)&&target.style.clip)
{
var l =
parseInt((document.getElementById)?target.style.left:target.style.pixelLeft);
var t =
parseInt((document.getElementById)?target.style.top:target.style.pixelTop);
var clipv = target.style.clip;
clipv=clipv.replace(/x/gi, "").replace(/t/gi, "");
clipv=clipv.split("rec(")[1].split(")")[0].split("p");
var ct = Number(clipv[0]);var cr = Number(clipv[1]);var cb =
Number(clipv[2]);var cl = Number(clipv[3]);
yyY=Math.abs(Math.round((ct-ey)/sy));dy=Math.round(-(ct-ey)/yyY);
yyX=Math.abs(Math.round((cl-ex)/sx));dx=Math.round(-(cl-ex)/yyX);
if(yyX<1)dx=0; if(yyY<1)dy=0;
ncl = cl + dx; nct = ct + dy; ncr = cr + dx; ncb = cb + dy;
target.style.pixelTop = t - dy;
target.style.pixelLeft = l - dx;
target.style.left = l - dx;
target.style.top = t - dy;
eval("target.style.clip = 'rect(' + nct + ' ' + ncr + ' ' + ncb
+ ' ' + ncl +')'");
yyY--; yyX--;
}
if(target.tmtScrollo)clearTimeout(target.tmtScrollo);
if(yyY>0||yyX>0){
var doTo = true;
}else if(delay>-1&&daLoop==true){
if(document.layers){
target.left = target.orileft; target.clip.left=0;
target.clip.right = (cr-cl); target.top = target.oritop;
target.clip.top=0; target.clip.bottom = (cb-ct);
}else{
eval("target.style.clip = 'rect(' + 0 + ' ' + (cr-cl) + ' ' +
(cb-ct) + ' ' +0 +')'");
target.style.top = target.oritop; target.style.left =
target.orileft;
}
var doTo = true;
}
if(doTo==true)target.tmtScrollo = setTimeout("yyLayerScroll(\"" +
daTarget + "\"," + delay + "," + ex+ "," + ey+ "," + dx+ "," + dy +
"," +sx + "," + sy + "," + false +","+daLoop + ")", delay);
}
function YY_LS(daTarget, yy_x,yy_y, delay, step, loop){
if(document.layers||document.all||document.getElementById)
yyLayerScroll(daTarget,delay, yy_x, yy_y, 0, 0,step,step, false,
loop, true);
}
function YY_StopLayerfx(){
var args = YY_StopLayerfx.arguments;var yydiv;
for (var i=0; i<args.length; i++){
yydiv=MM_findObj(args);
if
(yydiv&&(document.layers||document.all||document.getElementById)){
if(yydiv.yyto!=null)clearTimeout(yydiv.yyto);
if(yydiv.tmtScrollo!=null)clearTimeout(yydiv.tmtScrollo);
}
}
}
then is called like this
<a class=links
href="javascript:;" onMouseOut="YY_StopLayerfx('a2')"
onMouseOver="YY_LS('a2','128','0',50,7,false)"><img
src="../images/right.gif" border="0" width="11" height="20"></a>
Anyone know what is causing it not to work and how can you fix it.
Randy
I didnt work on the site then, but the javascript works in ie but not
in firefox. The scripting is
function yyLayerScroll(daTarget, delay, ex, ey, dx, dy, sx, sy, daT,
daLoop, daFirst ) {
var yyX; var yyY; var target = MM_findObj(daTarget);
if(!target.oritop){
target.oritop = (document.layers)?target.top:target.style.top;
target.orileft = (document.layers)?target.left:target.style.left
}
if (document.layers) {
var ct = target.clip.top; var cb = target.clip.bottom; var cl =
target.clip.left; var cr = target.clip.right;
yyY=Math.abs(Math.round((ct-ey)/sy)); dy=Math.round(-(ct-ey)/yyY);
yyX=Math.abs(Math.round((cl-ex)/sx)); dx=Math.round(-(cl-ex)/yyX);
if(yyX<1){dx=0}else{yyX--}; if(yyY<1){dy=0}else{yyY--};
var t = target.top; var l = target.left;
target.clip.top = ct + (dy); target.clip.bottom = cb +
(dy);target.top = t - (dy);
target.clip.left = cl + dx;target.clip.right = cr + dx; target.left
= l - dx;
}else if ((document.all||document.getElementById)&&target.style.clip)
{
var l =
parseInt((document.getElementById)?target.style.left:target.style.pixelLeft);
var t =
parseInt((document.getElementById)?target.style.top:target.style.pixelTop);
var clipv = target.style.clip;
clipv=clipv.replace(/x/gi, "").replace(/t/gi, "");
clipv=clipv.split("rec(")[1].split(")")[0].split("p");
var ct = Number(clipv[0]);var cr = Number(clipv[1]);var cb =
Number(clipv[2]);var cl = Number(clipv[3]);
yyY=Math.abs(Math.round((ct-ey)/sy));dy=Math.round(-(ct-ey)/yyY);
yyX=Math.abs(Math.round((cl-ex)/sx));dx=Math.round(-(cl-ex)/yyX);
if(yyX<1)dx=0; if(yyY<1)dy=0;
ncl = cl + dx; nct = ct + dy; ncr = cr + dx; ncb = cb + dy;
target.style.pixelTop = t - dy;
target.style.pixelLeft = l - dx;
target.style.left = l - dx;
target.style.top = t - dy;
eval("target.style.clip = 'rect(' + nct + ' ' + ncr + ' ' + ncb
+ ' ' + ncl +')'");
yyY--; yyX--;
}
if(target.tmtScrollo)clearTimeout(target.tmtScrollo);
if(yyY>0||yyX>0){
var doTo = true;
}else if(delay>-1&&daLoop==true){
if(document.layers){
target.left = target.orileft; target.clip.left=0;
target.clip.right = (cr-cl); target.top = target.oritop;
target.clip.top=0; target.clip.bottom = (cb-ct);
}else{
eval("target.style.clip = 'rect(' + 0 + ' ' + (cr-cl) + ' ' +
(cb-ct) + ' ' +0 +')'");
target.style.top = target.oritop; target.style.left =
target.orileft;
}
var doTo = true;
}
if(doTo==true)target.tmtScrollo = setTimeout("yyLayerScroll(\"" +
daTarget + "\"," + delay + "," + ex+ "," + ey+ "," + dx+ "," + dy +
"," +sx + "," + sy + "," + false +","+daLoop + ")", delay);
}
function YY_LS(daTarget, yy_x,yy_y, delay, step, loop){
if(document.layers||document.all||document.getElementById)
yyLayerScroll(daTarget,delay, yy_x, yy_y, 0, 0,step,step, false,
loop, true);
}
function YY_StopLayerfx(){
var args = YY_StopLayerfx.arguments;var yydiv;
for (var i=0; i<args.length; i++){
yydiv=MM_findObj(args);
if
(yydiv&&(document.layers||document.all||document.getElementById)){
if(yydiv.yyto!=null)clearTimeout(yydiv.yyto);
if(yydiv.tmtScrollo!=null)clearTimeout(yydiv.tmtScrollo);
}
}
}
then is called like this
<a class=links
href="javascript:;" onMouseOut="YY_StopLayerfx('a2')"
onMouseOver="YY_LS('a2','128','0',50,7,false)"><img
src="../images/right.gif" border="0" width="11" height="20"></a>
Anyone know what is causing it not to work and how can you fix it.
Randy