rlemon
07-27-2006, 04:02 PM
ok so apperently i don't know how to do this and i've searched google (for like 20 minutes) and can't find anything. i've probably passed over it and not realized. :confused:
i want a method as part of my class to call itself until {condition} is met.
however i keep getting Object Expected on pass #2
function myClass(v1,v2)
{
this.n = 0;
this.method = function()
{
this.n = Math.floor(this.n+1);
alert('in the method, pass' + this.n);
if(this.n < 10)
window.setTimeout(function(){this.method},1000);
}
}
window.onload = function()
{
var test = new myClass('v1','v2');
test.method();
}
i want a method as part of my class to call itself until {condition} is met.
however i keep getting Object Expected on pass #2
function myClass(v1,v2)
{
this.n = 0;
this.method = function()
{
this.n = Math.floor(this.n+1);
alert('in the method, pass' + this.n);
if(this.n < 10)
window.setTimeout(function(){this.method},1000);
}
}
window.onload = function()
{
var test = new myClass('v1','v2');
test.method();
}