Re: A couple of JS issues

by "Dackral Phillips" <htmlhacker(at)hotmail.com>

 Date:  Thu, 23 Mar 2000 13:25:54 CST
 To:  leo7278(at)hotmail.com
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
>what would make more sense is to extend the object with maybe a >start and 
>a stop method and give the layer the ability to move by >itself. is that 
>what you are trying to accomplish? - Cyanide_7

Ooh!  That sounds like a brilliant idea.  Any suggestions on how to 
implement that?  Sorry for not posting the code I was using when I asked the 
question.  I did get the object to stop when I put the setTimeout() function 
in an if block, but if I could write start() and stop() methods to control 
the action, I think it would be easier to modify.  Here's the code I'm using 
right now:

function move()
{
if(document.layers)
{
       var object = document.LAYERNAME;

}
else if (document.all)
{
       var object = LAYERNAME.style;
}

object.left = parseInt(object.left) - 5;
object.top = parseInt(object.top) + 2;

if (parseInt(object.left) >= 550)
{
    setTimeout('move()', 5);
}
else if (parseInt(object.left) < 550)
{
  object.top = parseInt(object.top) + 3;
  if (parseInt(object.top) <= 100)
  {
    setTimeout('move()', 5);
  }
}
}

This script right now drops a DIV from the top of the screen, right to left 
in parabolic motion.  I have it rigged to stop if the top value is greater 
than 100 pixels.  So how exactly do I make a DIV start and moving of it's 
own accord (I played with some while and for loops last night, but I 
couldn't get them to work).  Any suggestions would be appreciated.  Thanks.

Dack

010001000101001101010000010001000101001101010000
1   <><       Dackral Phillips           <><   1
0       http://www.redrival.com/dack           0
0      http://www.auburn.edu/~phillds          1
0      e-mail: htmlhacker(at)hotmail.com          0
1               ICQ: 65506604                  1
0    CHRISTIANITY COMPUTERS LANGUAGE CHESS     0
010001000101001101010000010001000101001101010000

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA