Complex JavaScript window framing parsing _javascript tips

Source: Internet
Author: User
Tags border color

What is window framing?

Window framing is to separate a browser document window into multiple windows, each window can display a separate page file, each frame (that is, the page) has its own URL.

How do I create a frame window?

Frames are typically created by the <frameset> and <frame> tags. However,,<iframe> tags in html 4 can also be used to create "inline frames" in the document. In terms of JavaScript, the frames created by,<iframe> are the same as those created by <frameset> and <frame>.

Split windows in HTML using <frameset> (split window tags),<frameset> in multiple window pages is equivalent to <body> status in the ordinary Single Window page, in the page with <frameset >......</frameset> logo page Main part of the starting and ending position. And the,<frameset> tag determines how the window is divided, and the position and size of each window. Its basic grammatical structure is as follows:

<frameset cols=n rows=n frameborder=yes|no border=n bordercolor= #n framespacing=n></frameset>

Cols and rows: The two parameters that determine how a page is split. Split the left and right windows with cols, the left and right widths of each frame are expressed as a percentage of the width of the window. For example: cols= "30%,40%,*" means that the horizontal direction is divided into three windows, respectively, the percentages of the total width of 30%,40% and 30%. where "*" means the remainder, that is, "*" the corresponding small window width is the remaining width. Divide the upper and lower windows with rows, using the same percentage setting method.

  frameborder: Specifies whether the window (ye) is to be bordered or not (no), and if the box is added, specify the width of the border with the border parameter, bordercolor the color of the specified border.

  framespacing: used to set the interval size between windows, the default value is 0.

When the window is split with the <frameset> tag, the properties of each window are defined with the HTML <frame> tag, so the <frameset> tag must contain the <frame> tag. Used to define the properties of each window. The syntax is as follows:

<frame align=left|center|right|top|bottomv name=framename src=url noresize Scrolling=yes|on|auto No bordercolor=#n marginheight=n marginwidth=n></frame>

  align: sets the window position by left, right, center (center), Upper (top), or bottom (bottom).

  Name : is used to specify the names of the windows, and SRC is used to specify the HTML page address for the splitter window.

  noresize: It is for the user, when the <frame> tag contains this parameter, the user can not adjust the size of the window with the mouse.

  scrolling: Set whether the window should scroll bar. Scrolling=no when not scroll bar, scrolling=yes when the scroll bar, Scrolling=auoto when the actual situation automatically set the scroll bar.

  frameborder and BorderColor: is the set window has no border and border color. However, the object is limited to a window with the <frame> tag.

  marginheight and Marginwidth: sets the width of the top and bottom edges of the window and the left and right edges respectively.

For example:

<frameset cols= "50%,*,25%" >
 <frame src= "http://www.baidu.com" noresize= "noresize"/>
 <frame src= "http://www.baidu.com"/>
 <frame src= "http://www.baidu.com"/>
</frameset>

What is the relationship between frame windows in JavaScript?
any frame of a window can refer to other frames through the top,frames and parent Properties.

JavaScript code in any window or frame can reference its own windows or frames as window or self.

Each window has a frames property. This property refers to an array of window objects, each of which represents the frames contained in the Windows (if a window has no frames, the frames[] array is empty and Frames.length is 0). This way, the window can be used Frames[0] To refer to its first frame, using frames[1] to refer to the second frame, and an analogy.

Each window also contains a parent property that refers to the Window object that contains it. In this way, the first frame in the window can reference its sibling frame, which is:

PARENT.FRAMES[1]

If a window is a top-level window, not a frame, then the Parent property refers to the window itself:

parent==self;

If a frame is contained in another frame, and the latter is included in the top-level window, the frame can use parent.parent to refer to the top-level window.

Precautions:
frames cannot coexist with body tags and content bodies

Frames are not conducive to search engine optimization, the normal front page does not recommend the use of frames.

The above is the entire content of this article, I hope to learn JavaScript program to help you.

Related Article

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.