Re: How to initial a object properties by functions?
- From: RobG <rgqld@xxxxxxxxxxxx>
- Date: Thu, 06 Jul 2006 21:28:46 +1000
RobG wrote:
[...]
// By convention, constructors start with a capital letter
function ClientENV()
{
// Set some default property values - not really necessary
// But keeps things tidy
this.os = 'default';
this.browser = 'default';
this.platform = 'default';
// Call setProperties, pass reference to the
// object being constructed
this.setProperties(this);
Hey, musta been asleep ... don't need to pass this:
this.setProperties();
}
ClientENV.prototype.setProperties = function(obj)
{
obj.os = 'blah OS';
obj.browser = 'blah Browser';
}
And setProperties is:
ClientENV.prototype.setProperties = function()
{
this.os = 'blah OS';
this.browser = 'blah Browser';
}
--
Rob
.
- Follow-Ups:
- References:
- Prev by Date: Re: How to initial a object properties by functions?
- Next by Date: onsubmit makes form.method lowercase
- Previous by thread: Re: How to initial a object properties by functions?
- Next by thread: Re: How to initial a object properties by functions?
- Index(es):
Relevant Pages
|