You may want to use self. self is a reference to the current document.
From within the iframe:
<body>
<div id="example">Example!</div>
<script type="text/javascript">
window.onload = function () {
var exampleNode = document.getElementById('example');
exampleNode.bar = function () {
// The highest window object:
top;
// The parent node:
self;
// The parent node ( except in IE );
this.ownerDocument.defaultView;
};
};
</script>
</body>
Traversing Multiple Window Objects:
Within the browser object model, the primary window object is referred to as top. Other global objects are arranged in a tree structure which stems from top. With a reference to top, you can navigate to the other global objects in the tree by using their names and relationships, much in the same way as you traverse the DOM.
When you have multiple window objects, as you do in the case of an iframe (of with old school framesets), the frame has a name attribute. Given the objects position relative to the top window object, you can use the name of the child to access the object.
<iframe src ="/default.html" name="advertisement"></iframe>
and then from the context of the top window:
self.advertisement