Can anyone tell me how to make my statement change color between green and yellow every fourth step of its movement. each move is 1 px in length? The statement is in the html page and just says "Mark the calendar".
Code:
var dom, x, y, a, b, a1, a2;
 function valcomp(){ dom = document.getElementById("take").style; 
a = document.getElementById("go").value; 
b = document.getElementById("go1").value; 
a1 = document.getElementById("c1").value; a2 = document.getElementById("c2").value;

 dom.left = a + "px";
 dom.top = b + "px"; 
x = a; y = b; move(x, y); }
 function change(x, y)
{
 if(x != a1) if(x > a1) x--; 
else if (x < a1) x++;
 if(y start!= a2) if(y > a2) y--; 
else if (y < a2) y++; if((x != a1) || (y != a2)){ dom.left = x + "px";
 dom.top = y + "px"; setTimeout("change(" + x + "," + y + ")"); }  }