[thelist] DHTML - just some code that won't work

Richard Bennett richard.bennett at skynet.be
Tue Oct 16 08:30:24 CDT 2001


Hi,
You didn't include the code of the actual object.
The Slide function isn't the object.
The "this" is referring to the slide-function, not the main object, so
this.obj=="undefined"

Or is this function inside the constructor of the main object?
If not you'd want to prototype it off the main object:

function MainObj(){

}
MainObj.prototype.Slide=function(){

}

and then :

blah=new MainObj()
blah.Slide()


Check my site for more of these things:
Richard.
www.richardinfo.com



----- Original Message -----
From: "jelle desramaults" <nsg_chong at hotmail.com>

> Guys, trying to do some DHTML coding (slide script), I just started
working
> with objects and referring to objects' property's using "this.whatever".
> I need to be able to pass "this" through a Timeout. This is where i run
into
> trouble. behold my code ...
>
>
>
>
//--------------------------------------------------------------------------
> ------------------------------------
> function Slide(MaxRight,Value,TimeInterval)
> {
> var xpos;
>
> xpos = parseInt(this.css.left);
>
> if (StayStatic==1)
>
> {
>  if(TimeoutSlideback) clearTimeout(TimeoutSlideback)
>  if (xpos < MaxRight)
>  {
>   xpos += Value
>   this.css.left = xpos
>
> // this is the line that matters - this is the line that matters - this is
> the line that matters - this is the line that matters
>
>   TimeOutSlide =
>
setTimeout(this.obj+".Slide("+MaxRight+","+Value+","+TimeInterval+")",TimeIn
> terval)
>
>  }
> }
> }






More information about the thelist mailing list