object's prototype variable inheritance

L

LittleNipper

I'm looking to do something like this:

function superDuperObject(range) {
this.startContainer = new superDuperObjectStartContainer(range);
}

function superDuperObjectStartContainer(range) {
this.calculatedContainerNumber = doSomethingAndGetSomethingBack(range);
return range.startContainer
}

function doSomethingAndGetSomethingBack(range) {
return
someCoolInformationThatICalculateInThisFunctionThatNeedsTheRange;
}

var myObject = new
SuperDuperObject(DOMRangeObjectThatIDefindedEarlierInCode);

// Show me the startContainer of
"DOMRangeObjectThatIDefindedEarlierInCode"
alert(myObject.startContainer);

// Show me the calculatedContainerNumber that I get from a function
that does stuff with the range passed to it
alert(myObject.startContainer.calculatedContainerNumber);

Thanks!
 
L

LittleNipper

By the way - the above doesnt work.. when you return the
alert(myObject.startContainer) is gives you a message saying something
like "undefined"...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top