Home  >  Article  >  Web Front-end  >  Complex javascript window frame analysis_javascript skills

Complex javascript window frame analysis_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:14:531169browse

What is window framing? ​

Window framing is to divide a browser document window into multiple windows. Each window can display an independent web page file, and each frame (i.e. page) has its own URL.

How to create a frame window?

Frames are usually created using the f900b4fc197b16ab214eecf015bb6bd2 and 04a0d55efbbfd646a993fbc01f262c57 tags. But in HTML 4, the d5ba1642137c3f32f4f4493ae923989c tag can also be used to create "inline frames" within the document. As far as JavaScript is concerned, d5ba1642137c3f32f4f4493ae923989c creates the same frame as f900b4fc197b16ab214eecf015bb6bd2 and 04a0d55efbbfd646a993fbc01f262c57.

In HTML, use f900b4fc197b16ab214eecf015bb6bd2 (split window tag) to split the window. The status of f900b4fc197b16ab214eecf015bb6bd2 in a multi-window page is equivalent to the status of 6c04bd5ca3fcae76e30b72ad730ca86d in an ordinary single-window page. In the page Use f900b4fc197b16ab214eecf015bb6bd2...eb5f059992a0ae0ef16884cb75644e40 to mark the starting and ending positions of the main part of the page. Furthermore, the f900b4fc197b16ab214eecf015bb6bd2 tag determines how the windows are divided, as well as 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: are the two parameters that determine how the page is divided. Use cols to split the left and right windows, and the left and right width of each frame is expressed as a percentage of the window width. For example: cols="30%,40%,*" means that it is divided into three windows in the horizontal direction, and the percentages of the total width of each are 30%, 40% and 30%. Among them, "*" represents the remaining part, that is to say, the width of the small window corresponding to "*" is the remaining width. Use rows to split the upper and lower windows, and also use the percentage setting method.

 frameborder: specifies whether each sub-window (ye) should add a border (no); if a frame is added, use the border parameter to specify the width of the border, and bordercolor to specify the color of the border.

 framespacing: is used to set the spacing between sub-windows. The default value is 0.

After dividing the window using the f900b4fc197b16ab214eecf015bb6bd2 tag, the attributes of each window are defined using the HTML 04a0d55efbbfd646a993fbc01f262c57 tag, so the f900b4fc197b16ab214eecf015bb6bd2 tag must contain the 04a0d55efbbfd646a993fbc01f262c57 tag for definition Properties of each sub-window. Its syntax is as follows:

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

 align: Set the position of the sub-window to the left (left), right (right), center (center), top (top) or bottom (bottom).

 name: is used to specify the name of the sub-window, and src is used to specify the HTML page address corresponding to the sub-window.

 noresize: is for the user. When the 04a0d55efbbfd646a993fbc01f262c57 tag contains this parameter, the user cannot use the mouse to adjust or modify the size of each window.

 scrolling: Set whether the sub-window requires scroll bars. When scrolling=no, scroll bars are not required. When scrolling=yes, scroll bars are required. When scrolling=auoto, scroll bars are automatically set according to the actual situation.

 frameborder and bordercolor: is used to set the border and border color of the sub-window. But the object is limited to sub-windows marked with 04a0d55efbbfd646a993fbc01f262c57.

 marginheight and marginwidth: are used to set the width of the upper and lower edges and the left and right edges of the sub-window 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 reference other frames through the top, frames and parent attributes.

JavaScript code within any window or frame can reference its own window or frame as window or self.

Each window has frames attribute. This property refers to an array of Window objects, where each element represents a frame contained in this window (if a window does not have any frames, then the frames[] array is empty and frames.length is 0). In this way, the window You can use frames[0] to reference its first frame, frames[1] to reference its second frame, and so on.

Each window also contains a parent attribute, which refers to the Window object containing this window. This way, the first frame in the window can reference its sibling frames, i.e.:

 parent.frames[1]

If a window is a top-level window rather than a frame, then the parent attribute refers to the window itself:

parent==self;

If a frame is contained within another frame, which is contained within a top-level window, then the frame can use parent.parent to reference the top-level window.

Note:
Frames cannot coexist with body tags and content

Framing is not conducive to search engine optimization. It is not recommended to use framing on normal front-end pages.

The above is the entire content of this article. I hope it will be helpful to everyone in learning javascript programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn