*.location.href usage:
top.location.href= "url" opens the URL on the top-level page (out of the frame)
self.location.href= "url" opens URL address only on this page
parent.location.href= "url" opens the URL address in the parent window
this.location.href= the "url" usage is consistent with the use of self
if (top.location = = self.location) Determines whether the current location is the top level to prevent frame references
If you have a custom frame on the page, you can also change parent self top to the name of the custom frame
The effect is to open the URL address in the Custom frame window
JavaScript frame Refresh
Reference:
--------------------------------------------------------------------------------
This is a simple example:
Here's the top.htm code
<script language=javascript>
Function Rs () {
parent.left.location.href= "Top.htm"
parent.bot.location.href= "Top.htm"
}
</script>
<input Type=button name=name value= "Ksdj" Onclick=rs ();>
Here is a random file name of the HTM file:
<frameset cols= "150,*" >
<frame src= "Left.htm" name=left>
<frameset rows= "150,*" >
<frame src= "Top.htm" name=top>
<frame src= "bot.htm" name=bot>
</FRAMESET>
</FRAMESET>
You try it yourself, I think you want to be the effect of this!
--------------------------------------------------------------------------------
I quote a reply from the man upstairs and help explain it.
Here's the top.htm code
<script language=javascript>
Function Rs () {
parent.left.location.href= "top.htm"//partent refers to the parent page, which is the outermost frame page, and left has to be the always object of the left page, and href is an attribute of the Location object, which determines the URL address of the left. So here's the address you need to give this parent.left.
parent.bot.location.href= "top.htm"//The meaning of this sentence is similar to the above.
}//function is complete, the update is implemented at the same time for two URLs!
</script>
<input Type=button name=name value= "Ksdj" Onclick=rs ();>
Here is a random file name of the HTM file:
<frameset cols= "150,*" >
<frame src= "left.htm" name=left> >//To this left.htm defined a name called Left
<frameset rows= "150,*" >
<frame src= "top.htm" name=top>//to this top.htm defined a name called top
<frame src= "bot.htm" name=bot>//to this bot.htm defined a name called bot
</FRAMESET>
</FRAMESET>
The Location property of the Window object contains the address (URL) information for the current page, and you can change this property value directly to a new address (URL):
window.location = "http://www.yahoo.com/";
Or
Location = "http://www.yahoo.com/";
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/script/