*. Location. href usage:
Top. Location. href = "url" opens the URL on the top-level page (jump out of the Framework)
Self. Location. href = "url" only opens the URL address on this page
Parent. Location. href = "url" opens the URL address in the parent form.
This. Location. href = "url" is used in the same way as self.
If (top. Location = self. Location) deduce whether the current location is the top layer to prohibit frame reference.
If a custom frame exists on the page, you can replace the parent self top with the name of the custom frame.
The effect is to open the URL address in the custom frame form.
Javascript frame refresh
Reference:
--------------------------------------------------------------------------------
This is a simple example:
Below is 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 ();>
The following is an HTM file with any file name:
<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>
Try it by yourself. I think you may want this effect!
--------------------------------------------------------------------------------
I quoted the reply from my old man upstairs. Could you explain it.
Below is the top.htm code
<Script language = JavaScript>
Function RS (){
Parent. left. location. href = "top.htm" // partentrefers to the parent page and the most external framework page. left.html is left.htm, location is the object of the Left page, and href is an attribute of the location object, which determines the left URL address. So here we will give the address you need To this parent. Left.
Parent. Bot. Location. href = "top.htm" // the meaning of this sentence is roughly the same as above.
} // The function ends. Two URLs are updated at the same time!
</SCRIPT>
<Input type = button name = Name value = "ksdj" onclick = RS ();>
The following is an HTM file with any file name:
<Frameset Cols = "150, *">
<Frame src = "left.htm" name = left> // defines a name for this left.htm: left
<Frameset rows = "150, *">
<Frame src = "top.htm" name = top> // defines the top.htm name as top.
<Frame src = "bot.htm" name = bot> // defines a bot name for this bot.htm.
</Frameset>
</Frameset>
The location attribute of the window object includes the address (URL) information of the current page. You can directly change this attribute value and set it to a new address (URL ):
Window. Location = "http://www.yahoo.com /";
Or
Location = "http://www.yahoo.com /";
You can also use either of the following two methods to enable the browser to download (load) pages from the server:
Reload ()-prompted the browser to download the current page again, that is, "refresh" the current page.
Replace (URL)-prompt the browser to download the Page Based on the address (URL) given in the URL threshold, and store the historical records in the current browser at the same time (that is, the list of browsed pages) to overwrite the current page.
Using the Replace () method means that the user will not be able to return to the previous page by pressing the "return" button, but this does not mean that the user cannot return to all the original pages, they just cannot return to the page replaced by the Replace () method (Note: Only the page replaced ).
Framedemo.html,top.html,button.html is used as an example to describe how to do this.
Framedemo.html consists of two pages:
<Frameset rows = "50%, 50%"> <frame name = Top src = "top.html"> <frame name = button src = "button.html"> </frameset>
For example, if top.html indicates that the above page has a button to refresh the following pages, you can use the following seven statements, which can be easily used.
Statement 1. Window. Parent. Frames [1]. Location. Reload ();
Statement 2. Window. Parent. frames. Bottom. Location. Reload ();
Statement 3. Window. Parent. Frames ["bottom"]. Location. Reload ();
Statement 4. Window. Parent. frames. Item (1). Location. Reload ();
Statement 5. Window. Parent. frames. Item ('bottom '). Location. Reload ();
Statement 6. Window. Parent. Bottom. Location. Reload ();
Statement 7. Window. Parent ['bottom ']. Location. Reload ();
Explanations:
1. windowless refers to the front page. For example, this example refers to the top.html page.
2. Parent refers to the parent page of the current page, that is, its framework page. For example, this example uses framedemo.html.
3. frames is a window object and an array. Represents all the child pages in the framework.
4. item is a method. Returns the elements in the array.
I have read some articles to my summary:
Top. Location is to open a new page in the top frame.
Window. Location is to open a new page in the current frame.
Parent. Location opens the URL address in the parent form of the current form.
Location. href user Summary