JS to achieve a variety of levels of direct page Jump @ Refresh page @ Frame set of integrated case __ Frame

Source: Internet
Author: User

1. Two ways to jump to another page:

window.location.href = ' 1.html '
Window.location.reload (' 11.html ')

2. If you use a frame, but want to jump to a page, rather than in the frame specified by the page to display, how to operate.
Parent.document.location.href= "./frontstage/login.jsp";

3. Refresh the parent page and current page with JavaScript
Window.parent.main.document.location.reload ()//Superior page
Document.location.reload ()//Current page

4. Each frame element or IFRAME element is a frame, which is a window in which an HTML document is loaded. You can refer to a frame or an IFRAME element by using the following methods:
Window.frames[index]
windows.frames["frame name"]
Windows. Frame Name

6. If you want to obtain a reference to a parent window from a Web page loaded by a frame, you can use the following method:
Window.parent

7. If you want to refer to a frame in the parent window, you can use the following method:
Window.parent. Frame Name

You can also use the following method to get a reference to the topmost frame of the parent window:
Window.top

8.html How to open a new Web page file in a frames frame
The first method is: window.open (' Url ', MainFrame, ' width=......,height= ... ');
Where: Url: Need to open the page; MainFrame: The frame that loads (contains) this page; Width=......,height= ..... : Style settings for the page
Another method is: MainFrame.document.location = "URL"; That is, the URL that specifies mainframe directly is pointed to a URL.
Of course, similar can also be used document.getElementById ("MainFrame"). src = "URL";
The first method is to passively specify which frame a page is loaded into; The latter two methods actively set which page the frame will load

10.html Instance Reference Reference: (This example is the left and right frame structure); This opens with the Name property of the frame to specify the open location
_blank opens the linked document in a new browser window while keeping the current window unchanged.
_parent opens the linked document in the parent frameset of the linked frame, replacing the entire frameset.
_self opens the link in the current frame, replacing the contents of the frame.
_top opens the linked document in the current browser window, replacing all frames.

1. Main Frame page:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 frameset//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" >

<meta http-equiv= "Content-type" Content= "text/html; charset=gb2312 "/>
<title> Untitled document </title>
<frameset rows=" * "cols=" 138,* " framespacing= "1" frameborder= "yes"
 border= "1" bordercolor= "#000000"
 <frame src= " Left.html "Name=" Leftframe "scrolling=" No "
  noresize=" noresize "id=" Leftframe "/>  <frame Src= "right.html"
  name= "MainFrame" id= "MainFrame"/>
</frameset>
<noframes>
 <body></body>
</noframes>

2. Left frame page:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
<meta http-equiv= "Content-type" Content= "text/html; charset=gb2312 "/>
<title> Untitled document </title>
<body link=" Black "vlink=" Olive " alink= "Blue"
 <p>
  <a href= "My home page. html" target= "MainFrame" > My home </a>
 </p>
 <p>
  <a href= "my diary. html" target= "MainFrame" > My diary </a
 </p>
</body>

3. Right frame page:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
<meta http-equiv= "Content-type" Content= "text/html; charset=gb2312 "/>
<title> Untitled document </title>
<body></body>
< /html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.