Actually I am a bit confused by your page setup. I think iframe is a HTML specific feature where you can create an inline frame based on another document. This inner document may have an entirely independent communication with the web server. Only thing is that it has been nested inside another page.
In your case if you want to pass some value from the inner frame to the enclosing page, I would think a better approach is to have them as 2 separate pages, though I am curious to know if the value can somehow be passed to the enclosing page.