Advertisement

09.16.2004 at 08:04AM PDT, ID: 21133652
[x]
Attachment Details

Functions will not work after the first try.

Asked by loupefocus in JavaScript

Tags: , ,

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,-90,-100,-120,-140,-160,-180,-200,-220,-240,-260,-280,-300,-320,-340,-360,-380,-400,-420,-440,-460,-480,-500,-520,-540,-560,-580,-585,-590,-595,-600,-600,-600,-598,-595,-593,-590,-587,-586,-584,-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('certified').style.left=xPos+"px";
            if(pathIndex<duoPathOne2Two.length-1)
            {
                  moveID=setTimeout("moveOne2Two()",5);
            }
      }
            
      function moveTwo2One()
      {
            clearTimeout(moveID2);
            var xPos2 = duoPathTwo2One[pathIndex2];
            pathIndex2+=1;
            document.getElementById('certified').style.left=xPos2+"px";
            if(pathIndex2<duoPathTwo2One.length-1)
            {
                  moveID=setTimeout("moveTwo2One()",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();return false;"><img src="news.jpg" width="584" height="125" alt="" border="0" /></a></td>
        <td><a href="javascript://" onclick="moveTwo2One();return false;"><img src="news2.jpg" width="584" height="125" alt="" border="0" /></a></td>
      </tr>
    </table>
  </div>
</div>

</body>
</html>

Start Free Trial
 
Loading Advertisement...
 
[+][-]09.16.2004 at 08:15AM PDT, ID: 12075573

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.16.2004 at 08:17AM PDT, ID: 12075595

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.16.2004 at 08:17AM PDT, ID: 12075605

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.16.2004 at 08:18AM PDT, ID: 12075609

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.16.2004 at 08:23AM PDT, ID: 12075672

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.16.2004 at 08:23AM PDT, ID: 12075679

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.16.2004 at 08:45AM PDT, ID: 12075950

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: javascript, work, function
Sign Up Now!
Solution Provided By: ragerino
Participating Experts: 4
Solution Grade: A
 
 
[+][-]09.16.2004 at 12:02PM PDT, ID: 12078081

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32