« first day  last day (14 days later) » 

4:36 AM
Your comment on adding script directly to the button is great! I can think of a way like this: let the button inside the iframe invoke a function defined in main page, and pass the window.frameElement as argument to that function. By this, I can minimize button action function and concentrate my code in main page script.
Thank you for all your effort upon this question. You really help me think a lot more. If you would like to do so, you can write it as a new answer, and I will accept it.
 

« first day  last day (14 days later) »