Get a user-defined object in Javascript
<p>I have a script which creates a user-defined object like this:</p>

<pre><code>obj = new Tree();
</code></pre>

<p>This object is always present and interacting with the user.</p>

<p>I want to create a button on the page which, if pressed, should retrieve this object, make some changes to the object and call some methods.</p>

<p>If this were a DOM object, I could have used any of getElementById() or getElementByTagName() etc. However, this object is created in the script and I need to access it in another part on user intervention. Further, making the object global is not an option. Does anybody know how it may be done?</p>
