How to exit from full screen iframe by escape key so that iframe gets back into its originalsize. Please suggest me开发者_StackOverflow javascript code for this as jquery is not working in html page.
Here is the code for fullscreen iframe.
<iframe name='myiframe2' id='frame2' src=http://stackoverflow.com' style='position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:999' frameborder='no'></iframe>
Do you mean this (you cannot frame stackoverflow btw)?
<iframe name="myiframe1" id="frame1" src="javascript:'hello 1'"
style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:999" frameborder="no"></iframe>
<iframe name="myiframe2" id="frame2" src="javascript:'hello 2'"
style="display:none;width:300px;height:300px" frameborder="yes"></iframe>
<script>
document.onkeypress=document.onkeydown = function(evt) {
evt = evt || window.event;
var kc = evt.which || evt.keyCode;
if (kc==27) {
document.getElementById('frame2').style.display=''
document.getElementById('frame1').style.display='none'
}
}
</script>
精彩评论