I am not a guru at this, but the 2 functions are running there own space, so FormProperty has no property named name which is what I belieb you are trying to set.
On 11/10/06, Pacific Fox <[EMAIL PROTECTED]> wrote:
Hi all,
I know it's JS, but I'm sure there are some JS gurus on here...
I've got a base object that works fine with named arguments when called
on it's own. However when I call the child object I get an error "arg
has no properties" (in firefox).
A simple test:
Property = function( arg ) {
/**
* Private properties
*/
var name = arg.name; // required, the name of the field
/**
* Priviliged methods, may be invoked publicly and may access private
variables
*/
this.getName = function() {
return name;
}
};
/**
* Class for form field properties, extends property
*/
FormProperty = function( arg ) {
/**
* Inheritance
*/
this.super = Property;
this.super( { name:arg.name } );
this.prototype = new Property;
}
//property = new FormProperty( { name:"myVar" } )
property = new Property( { name:"test" } )
alert( property.getName() );
Uncomment //property = new FormProperty( { name:"myVar" } )
to get the error.
Thanks in advance for any help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---
- [cfaussie] Re: [OT] JavaScript (YES) named arguments and inhe... Andrew Scott
