I have also used the following solution when you need to change the parent frame border text when a click event is fired within an iframe and the user has tested the submit button:
<script>
$("button").click(function(){
if ($('.email').val() !== 'Enter Your Best Email'){
$('.x_out', top.document).text('<< Back to the main page');
}
});
</script>
Upon testing the submit button once, the user is prompted with a tooltip reminder of "!Please fill out this field." via the HTML5 onclick="validate();"
Upon testing the submit button the second time, the border enclosing the iframe has text within a closing link change to guide them back to the main page (i.e. the closing link closes the iframe and clicking the button within the iframe changes this text in the parent frame).