469,336 Members | 6,132 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

inner object parent variable reference

Hi, I have an error when I try to make:

CustomObj =
{
is_all : Compatible(),

Types :
{
PASS : CustomObj.as_all ? "ok" : "onok",
...
...
...
but in an object literal notation I cannot use a parent object
variable? or
can I do to create a global variable inside my parent class
(CustomObj) and
than to use in my children objects like Types?

Thanks

Sep 11 '07 #1
1 3831
pr
josh wrote:
Hi, I have an error when I try to make:

CustomObj =
{
is_all : Compatible(),

Types :
{
PASS : CustomObj.as_all ? "ok" : "onok",
Didn't you mean
PASS : CustomObj.is_all ? "ok" : "onok"
?
but in an object literal notation I cannot use a parent object
variable?
javascript doesn't have a 'parent' built-in variable.
can I do to create a global variable inside my parent class
(CustomObj) and
than to use in my children objects like Types?
CustomObj = new (function() {
var parent = this;

this.is_all = Compatible();
this.Types = { PASS: parent.is_all ...};
})
Sep 11 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by R | last post: by
10 posts views Thread by Paul Morrow | last post: by
28 posts views Thread by Daniel | last post: by
12 posts views Thread by marcadonis | last post: by
8 posts views Thread by olov.johansson | last post: by
3 posts views Thread by from.future.import | last post: by
3 posts views Thread by ChrisW | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.