views:

20

answers:

1

I have a div I want to hide when I press F2... Everything works fine, except when the focus is on an iframe below this div...

<script> 
document.onkeyup = KeyCheck;

function KeyCheck(){
   var KeyID = event.keyCode;
   switch(KeyID)
{ case 113:
   document.getElementById("test").style.display = "none" }
break;
}

</script>

But like I say, when focused on an iframe, this piece of script has no effect... Where am I going wrong?

A: 

Well, iframe displays another HTML document. That means inside an iframe element exists another DOM structure totaly different than the one outside it. So question is, do you really need to use frames? There are other ways to display content in the iframe "fashion".

Ventus