Yes, if the page in the iframe was loaded from the same domain as the page containing the iframe (this is the same-origin policy).
Note that the iframe and containing page both have a global 'window' object, but they are different.
To access variables and functions from scripts in the inner frame from the outer page, you'd need to be able to reference the iframe as an object. For example, if it's the only iframe on the page, you could just prepend window.frames[0].
to any variable name and you'll be referring to the one declared by the scripts in the iframe. If it's not, then you may have to locate the iframe using an ID:
var iframewindow = document.getElementById('myframe').contentWindow;
// read the content of the 'myvar' variable which was set within that frame.
alert(iframewindow.myvar);
To access the outer page's variables and functions from the inner page, you'd prepend window.parent.
to the start of them.