[Javascript] (no subject)

Mike Dougherty mdougherty at pbp.com
Thu Apr 15 14:02:52 CDT 2004


Question 1 of 2:

I'm developing a stateful interface (with Javascript and DHTML) to customize an object.  Suppose I 
have the following:

loMainItem.Item0200[1].Item0250[1].Item0100[1] = new Item0100( *paramlist* )

where:
function Item0100( param1,param2,param3 ) {
   if (param1 == 0) {
     this.prop1 = loMainItem.prop1  /* inherit from loMainItem */
     *** more code removed for brevity ***
     } /* if(param1 == 0) */
     else {
       this.prop1 = param1 /* value from parameter */
       *** more code removed for brevity***
       } /* ELSE: if(param1 == 0) */
   } /* Item0100(..) */


Can the loMainItem object be referenced if it is defined in a global scope?  (it does not appear 
to work)  This would be a lazy solution to a server-side data aquisition problem that would 
probably be better served 'the right way' - so I'm mostly interested in an explaination of any 
scoping issues around the object constructor function.

Question 2:
   Given the object(s) above, can I implicitly reference an object's parent with "this.parent"? 
 Most of the online help i've seen refers to the parent of built-in objects, so I don't know how 
to use it on custom objects.
ex:
   loCurrentItem0100 = loMainItem.Item0200[1].Item0250[1].Item0100[1]
   alert( "Parent object: " + loCurrentItem0100.parent.Item0250Id )



More information about the Javascript mailing list