Lateral movement occurs |
when the x ordinate varies and the y ordinate remains constant |
Vertical movement occurs |
when the y ordinate varies and the x ordinate remains constant
|
function move1(){
var step=2;
var x=document.getElementById('profr').offsetLeft;
if(x < 400 )
{x= x +step;
document.getElementById('profr').style.left= x + "px";
setTimeout('move1()',10};
}
function move3(){
var step=-2;
var x=document.getElementById('profl').offsetLeft;
if(x > 400 )
{x= x +step;
document.getElementById('profl').style.left= x + "px";
setTimeout('move3()',10);}
}
function move5(){
var step=2;
var y=document.getElementById('profd').offsetTop;
if(y < 400 )
{y= y +step;
document.getElementById('profd').style.top= y + "px";
setTimeout('move5()',10);}
}
function move7(){
var step=-2;
var y=document.getElementById('profu').offsetTop;
if(y > 50 )
{y= y +step;
document.getElementById('profu').style.top= y + "px";
setTimeout('move7()',10);}
}