There are many uses of location.href in JavaScript, mainly as follows.
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
location.href= "/url" Current page Open URL page
windows.location.href= the current page of "/url" opens the URL page, the previous three usages are the same.
If the page has a custom frame, you can change parent self top to the name of the custom frame, which opens the URL address in the frame window
In addition, Window.location.href=window.location.href and Window.location.Reload () and both are refreshing the current page. The difference is whether the data is submitted. When there is a submission, window.location.Reload () prompts for the submission, Window.location.href=window.location.href, and submits the data to the specified URL
Location page Jump JS as follows:
| code is as follows |
copy code |
| //Simple jump function gotoPage (URL) { //eg. var url = "newsview.html?catalogid=" +catalogid+ "&pageid=" +pag Eid window.location = URL; } //Upgrade to location usage, pass parameters for individual pages function Goto_catalog (icat) { if (icat<=0) { Top.locati On = ". /index.aspx "; Top out } Else { Window.location = "... /newscat.aspx?catid= "+ICAT; } //jump page for specified frame, two methods are available function goto_iframe (URL) { Parent.mainFrame.location = "... /index.aspx "; //Parent.document.getElementById ("MainFrame"). src = ". /index.aspx ";/use DOM to change page//At the same time I added the DOM to the } //Jump page for the specified frame because parent.iframename.location=" ... /index.aspx "; Methods can not be implemented, mainly "Parent.iframename" in the Iframename in JS is the default node, and can not transfer the parameters passed over, so with the DOM to achieve the pass two parameters of the frame jump page, I hope that the man is not hesitate to enlighten! Function Goto_iframe (iframename,url) { Parent.document.getElementById (iframename). src = ". /index.aspx;/Use DOM to change page by Iframename //} //Back to Home function GoHome () { Top.location = "/index.aspx"; } </script> |