Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing a particular frame

Status
Not open for further replies.

aleci

Programmer
May 22, 2001
40
GB
Hi,
My site consists of 3 frames; a top frame, a lhs frame and a main frame.
The problem i am encountering is that if I click the broswers' refresh button, the whole frameset is reloaded and the user is returned to the index page (as defined in the frameset), regardless of the page they were on. Obviously undesirable!

However right clicking within the bottom frame and selecting refresh here gives me exactly the desired result.

My question is this; Is there any way i could make the browsers' refresh button mimic this action of right-clicking in the bottom frame and refreshing there ?

BTW, I am a Javascript novice
Any suggestions/tips will be hugely appreciated!
 
well, here is a script that catches F5:
Code:
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function fKeyCheck(e)
{
var charCode =(document.layers) ? e.witch : e.keyCode
var thestatus = charCode //Ascii code
  if (thestatus == 116){
//alert(&quot;F5&quot;);
e.keyCode = 0} 
  return false
}

document.onkeydown=function(){return fKeyCheck(event)}

</SCRIPT>
(tested in ie6 only, sorry)

& here is how to refresh bottom frame (bottom is a frame name)
Code:
top.frames.bottom.location.reload(1);

so, you could combine them into one function:
Code:
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
function fKeyCheck(e)
{
var charCode =(document.layers) ? e.witch : e.keyCode
var thestatus = charCode //Ascii code
  if (thestatus == 116){
//alert(&quot;F5&quot;);
e.keyCode = 0} 
top.frames.bottom.location.reload(1);
  return false
}

document.onkeydown=function(){return fKeyCheck(event)}
//-->
</SCRIPT>
hey, i'm not saying that this would 100% work everywhere, just a try.. Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top