[thelist] help modify a JS

Le Sauvage sauvage at ureach.com
Sat Oct 19 23:15:01 CDT 2002


Will someone help me, please? I am very sorry, but I am javascript-challenged :-
(

In the script below, I want the object to move horizontally from the
right side of the window instead of from the left. It then moves to the left.
For example, startX=1000, endX=0, startY=500, endY=500 (or endY=501 will not
matter, as it is hard to see the difference in 1 pixel anyway). Then it
reappears where it first began and starts all over again (looping).

Many thanks and best regards!

kris

--------------------------------------------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

<HTML>
<HEAD>

<SCRIPT  LANGUAGE="JavaScript1.2">
<!--

// Animation parameters
startX = 0;
startY = 500;
endX = 900;
endY = 501;
deltaX = 1;
deltaY = 0;
movePeriod = 50;

// Animation code
function movement() {
 if(currentY >= endY || currentX >= endX) {
  currentX = startX;
  currentY = startY;
  } else {
  currentX += deltaX;
  currentY += deltaY;
  }
 }

function setPosition(x,y) {
 divStyle.left = currentX;
 divStyle.top = currentY;
 }

function moveDiv() {
 movement();
 setPosition();
}

function moveImage() {
 if(!document.all) document.all = document;
 if(!document.all.mi.style) document.all.mi.style = document.all.mi;
 divStyle = document.all.mi.style;
 currentX = startX;
 currentY = startY;
 setPosition(currentX, currentY);
 divStyle.visibility = "visible";
 setInterval("moveDiv()",movePeriod);
 }

window.onload = moveImage;

//-->
</SCRIPT>

</head>

<body bgcolor="#ffffff">

<DIV ID="mi" STYLE="position:absolute;visibility:hidden">
<IMG SRC="whatever.gif" alt="image description" WIDTH="80" HEIGHT="80">
</DIV>

</BODY>
</HTML>



________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag



More information about the thelist mailing list