Please help... I am going crazy!!!!
I cannot get these functions to work more than once. What am I doing wrong?
When I click on the first image, the layer moves to the left. When I click on the second image, the layer moves to the right. I would like this to happen repeatedly, but instead, after this happens once, it does not work anymore. Please help me figure out what I am doing wrong! Thanks!!!
----------
<html>
<head>
<title>Test...</title>
<script type="text/javascript">
var duoPathOne2Two = new Array(0,-20,-40,-60,-80,-9
0,-100,-12
0,-140,-16
0,-180,-20
0,-220,-24
0,-260,-28
0,-300,-32
0,-340,-36
0,-380,-40
0,-420,-44
0,-460,-48
0,-500,-52
0,-540,-56
0,-580,-58
5,-590,-59
5,-600,-60
0,-600,-59
8,-595,-59
3,-590,-58
7,-586,-58
4,-584);
var duoPathTwo2One = new Array(-584,-584,-586,-587,
-590,-593,
-595,-598,
-600,-600,
-600,-595,
-590,-585,
-580,-560,
-540,-520,
-500,-480,
-460,-440,
-420,-400,
-380,-360,
-340,-320,
-300,-280,
-260,-240,
-220,-200,
-180,-160,
-140,-120,
-100,-80,-
60,-40,-20
,0,0);
var pathIndex=0;
var moveID=null;
var pathIndex2=0;
var moveID2=null;
function moveOne2Two()
{
clearTimeout(moveID);
var xPos = duoPathOne2Two[pathIndex];
pathIndex+=1;
document.getElementById('c
ertified')
.style.lef
t=xPos+"px
";
if(pathIndex<duoPathOne2Tw
o.length-1
)
{
moveID=setTimeout("moveOne
2Two()",5)
;
}
}
function moveTwo2One()
{
clearTimeout(moveID2);
var xPos2 = duoPathTwo2One[pathIndex2]
;
pathIndex2+=1;
document.getElementById('c
ertified')
.style.lef
t=xPos2+"p
x";
if(pathIndex2<duoPathTwo2O
ne.length-
1)
{
moveID=setTimeout("moveTwo
2One()",5)
;
}
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div style="position:absolute; top: 0px; left:0px; width:584px; height:125px; clip:rect(0px 584px 125px 0px); overflow:hidden;" id="news">
<div id="certified" style="position:absolute; left:0px; top:0px; width:584px; height:125px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="javascript://" onclick="moveOne2Two();ret
urn false;"><img src="news.jpg" width="584" height="125" alt="" border="0" /></a></td>
<td><a href="javascript://" onclick="moveTwo2One();ret
urn false;"><img src="news2.jpg" width="584" height="125" alt="" border="0" /></a></td>
</tr>
</table>
</div>
</div>
</body>
</html>
Start Free Trial