By using the framework, you can display more than one page in the same browser window. Each HTML document is called a frame, and each frame is independent of the other frames
-
Frame structure label (<frameset>)
-
- Frame structure label (<frameset>) defines how to split a window into a frame
- Each frameset defines a series of rows or columns
- The Rows/columns value specifies the area of the screen that each row or column occupies.
Frame labels (frame)
The frame tag defines the HTML document that is placed in each frame.
In the following example, we set up a two-column frameset. The first column is set to occupy 25% of the browser window. The second column is set to occupy 75% of the browser window. The HTML document "Frame_a.htm" is placed in the first column, and the HTML document "Frame_b.htm" is placed in the second column:
<frameset cols= "25%,75%" >
< frame src= "frame_a.htm" >
<frame src= "Frame_b.htm" >
</frameset>
Object Collection of window in JavaScript : frames[];
Returns all named frames in the window.
The collection is an array of window objects, each of which contains a frame or <iframe>. The Frames.length property holds the number of elements contained in the array frames[]. Note that the frames referenced in the frames[] array may also include frames, which themselves also have frames[] arrays.
A property top of the Window object;
The top property returns the topmost ancestor window.
This property returns a read-only reference to a top-level window. If the window itself is a top-level window, the top property holds a reference to the window itself. If the window is a frame, then the top property references the top-level window that contains the frame.
Syntax: Window.top
Basic considerations-Useful tips:
If a frame has a visible border, the user can drag the border to change its size. To prevent this from happening, you can add: noresize= "Noresize" to the <frame> tag.
Add <noframes> tags to browsers that do not support frames.
Important: You cannot use the <body></body> tag with the <frameset></frameset> tag simultaneously ! However, if you add a <noframes> tag that contains a piece of text, you must nest the text in the <body></body> tag.
This example shows how to make a frame structure with three documents and mix them in rows and columns.
Hybrid frame:
<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <title></title></Head><Framesetrows= "25%,*">//the * number is equivalent to 1-25%<Framesrc= "frame1.html"> <Framesetcols= "15%,*"> <Framesrc= "frame2.html"> <Framesrc= "frame3.html"name= "Frame3"> </Frameset></Frameset></HTML>
View Code
<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <title></title></Head><Body><H1>Frame2</H1><ahref= "jg22.html"Target= "Frame3" >Jg22</a><BR/><BR/><BR/><ahref= "jg23.html"Target= "Frame3">Jg23</a><BR/><BR/><BR/><ahref= "jg24.html"Target= "Frame3">Jg24</a><BR/><BR/><BR/></Body></HTML>
View Code
<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <title></title> <Script>window.onload=function(){ varBNT=document.getElementsByTagName ('Button')[0]; varBnt1=document.getElementsByTagName ('Button')[1]; varBnt2=document.getElementsByTagName ('Button')[2]; Bnt.onclick=function() {window.top.frames[2].history.go (-1);//previous }; Bnt1.onclick=function() {window.top.frames[2].history.go (1);//Next }; Bnt2.onclick=function() {window.location.href="change.html";//only change the frame1 page in the browser windowWindow.top.location.href="change.html";//change the entire browser window page } } </Script></Head><Body><H1>Frame1</H1><Button>Previous</Button><Button>Next</Button><Button>Change</Button></Body></HTML>View Code
:
HTML Frame Frameset,frame