Subj : Re: Object properties that dont yet exist? To : netscape.public.mozilla.jseng From : genisiob@pilot.msu.edu (Brian) Date : Tue Oct 07 2003 11:27 am SOrry to reply to my own message, but I understand more now than when I wrote this. Now, I see that I can generate an AddProperty callback when this is done, which gives me a big id number (1559158). If I set the value, I also get the SetProperty callback with the same big id number. Can I assume that the id will be the same, and use it as a generic lookup number? Is there anyway for me to determine the name of the property that the script is creating? Thanks, Brian genisiob@pilot.msu.edu (Brian) wrote in message news:<713f4923.0310070619.5f7be985@posting.google.com>... > Hello all, > > In Mozilla, if I run the following script, it works: > > document.somejunk = 5; > alert(document.somejunk); > > How does this work? The somejunk property of document surely was not > defined in their model, yet the variable obviously gets added as a > property of document for access. > > I am implementing a javascript model where I want the same thing to > happen... I want to have access to properties that I have not > explicitly defined. > > Now, if my object is something like this: > > Foo = { int junk; int bar } > > and a user sets Foo.somejunk, my error handler gets triggered, and the > script aborts. > > Instead, I want to have a catchall for the object, where I can store > somejunk as a property. Likewise, I want to catch somejunk as a > property when it is being accessed, look up the value, and return > it... much like the browser does. > > How is this done? > Thanks, > Brian .