Subj : Re: Spidermonkey JS question To : I?igo Koch From : Brendan Eich Date : Tue Nov 04 2003 11:30 am I?igo Koch wrote: >Hi, > >I need to create an object that at the same time has a string value: > >foo = "string1"; >foo.bar = "string2"; > >It must be possible since browsers have a lot of these cases: >location = "str"; >location.href = "str"; >etc.. > > Mozilla uses a setter for window.location that can turn the string into a URL, and internally do the equivalent of 'location.href = string'. You can define a setter for an individual property when you define the property, using JS_Define*Property. You can also define a class setProperty hook that special-cases based on id. /be >Thank you in advance for any light on this problem, > >regards, > >Iņigo Koch > > .