Is there a way to access JavaScript objects in the same way HTML elements can be access from JavaScript. For example, if I had a document which contained the following JavaScript code:
<script language=”JavaScript”>
var myObj = {
this.name = “foo”;
this.age = 5;
}
</script>
How could I access myObj? Is it a property of the document object? For example, could I do:
document.myObj.name = “new name”;
I realise this isn’t actually necessary. However for the purpose of the question, I do need to be able to access the JavaScript objects from either the window or document objects?
In other words, where to JavaScript objects in the JavaScript context reside? In the document object? In the window object?