View Single Post
Old 02-26-2008, 11:53 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
'this' in a prototype?

shouldn't i be able to assign object values to 'this' in a prototype of a js object? i think the answer is no since i'm asking this, but i need ideas on a different way to do this.

PHP Code:
function myclass(foobar) {
  
this.foo foo;
  
this.bar bar;
}

myclass.prototype.update(newfoonewbar) {
  
this.foo newfoo;
  
this.bar newbar;
}

// now i'll try it
var myobj = new myclass(00);

myobj.update(11);

// myobj.foo and myobj.bar still equal 0 here 
so, from a prototype, or any member function of a javascript class, how do i change a member property? this seems so basic.
__________________
testing 1 2 3
sde is offline   Reply With Quote