Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Control the F5 behavior in a page that has FRAMES


Message #1 by "Luís Pinho" <lspinho@m...> on Thu, 7 Nov 2002 14:30:32
Hi there,
  I can capture the event of pressing F5 in a page with FRAMES using a 
code posted in this site:

*********** Begining **********

<SCRIPT>
if (document.all)
{
 document.onkeydown = function ()
 {
     var key_f5 = 116; // 116 = F5
  if (key_f5==event.keyCode)
  {
   event.keyCode=0;
   alert (event.keyCode+" F5 was press!");
   return false;
  }

 }
}

</SCRIPT>

*********** End ***********

This piece of code disables the F5 key, it prevent a person from 
refreshing a page using F5 key.

I want to do something diferent, when a user presses F5 instead of 
refreshing the entire frameset, I want to refresh a particular frame 
(simulate: right-click within the frame and choose Refresh from the pop-up 
menu)

Thank You

Pinho

  Return to Index