Exp11 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Experiment No. 11.

2
Aim: Develop a Web page for working with child window.
Theory:
A child window is created using frames in a web page.
Creating frame:
Frames are used to divide browser window into multiple sections where each section is treated as window
that can have independent contents. A frame can load separate HTML document in each frame in a window.

<frameset> tag : A frameset is defined as a set of frames inserted in an HTML web page. These frames
can be in the form of rows and columns in different size. Frameset tells the browser how to divide the screen
into multiple areas.
<frameset> ... </frameset>

Attributes:

cols=”pixels/percentage” Specify number and size of columns in a frameset. Default value


is 100% ( 1 column).
rows=”pixels/percentage” Specify number and size of rows in a frameset. Default value is
100% ( 1 row).
border=number Specify thickness of frame border. Default value is 5 pixels.
bordercolor=”colorname/colorcode” Specify color for border.
frameborder=”yes/no” Specify whether the border shall be visible or not.

<frame> tag : Frame tag is used to insert web page content in a frame. It is an empty tag.
Attributes:

src=”URL” Specify address of a web page to be displayed in a frame.


name=” string” Specify name of the frame which can be used as target to open a
link.
frameborder=”yes/no” Specify whether the border should visible or not.
bordercolor=”colorname/colorcode” Specify border color.
scrolling=”yes/no/auto” specify appearance of scroll bar in a frame. Default value is auto.
marginheight=number Specify space between contents of frame and top/bottom border
of frame.
marginwidth=number Specify space between contents of frame and left/right borders of
frame.
noresize Specify that a frame is not resizable.

JavaScript refers to the frameset as the top or the parent. The parent frame is always on top of the display.
The other frames inside the frameset are referred as child frames. Child windows always appear within the
parent window and can have unique name to be used in an application.
Programs:
Example: - A window divided into two rows:
Code: Output:
<html>
<frameset rows="25%,75%" frameborder="Yes"
bordercolor="red">
<frame src="page1.html" name="f1">
<frame src="page2.html" name="f2"> </frameset>
</html>

Example A window divided into two columns:


Code: Output:
<html>
<frameset cols="25%,75%" frameborder="Yes"
bordercolor="red">
<frame src="page1.html" name="f1">
<frame src="page2.html" name="f2">
</frameset>
</html>
Dividing in rows and columns:
Code: Output:
<html>
<frameset rows="25%,50%" frameborder="Yes"
bordercolor="red">
<frame src="page1.html" name="f1">
<frameset cols="25%,75%">
<frame src="link.html" name="f3">
<frame src="page3.html" name="f4">
</frameset>
</frameset>
</html>

Write code to design your own framed web page with atleast three frames for any
application.

Practical Related Question(observation):


1. Write use of focus() method with respect to child window.
Ans.

2. Write statement to make frame border invisible when a web page is loaded in the browser.
Ans.

3. Write code to change content of a child window using location property of window.
Ans.

4. Write code to change text on button in frame1 when clicked on ‘change’ button in frame 2.
Ans.

Conclusion: With all the concepts based on working with child window , successfully executed all
programs with correct output.

You might also like