Saturday 9 August 2014

html frame example

1. The following code will create a frame.

$vi frame.htm

<html>

<frameset cols="10%,*" border="7" bordercolor="red">
    <frame name="leftFrame" src="navigation.htm" marginheight=30 marginwidth="5">
    <frame name="mainFrame" src="mainHome.htm" marginheight="30" marginwidth="25">

</frameset>

</html>


NOTE: the frame name that you can do the target to for other pages.

2. navigation page:

$vi navigation.htm

<html>
<head>
   
</head>

<body>
   
<H5><u>Navigation</u></H5>
<a href="mainHome.htm" target="mainFrame"a>Home</a><br>
<a href="page1.htm" target="mainFrame"a> Page1<br>
<a href="page2.htm" target="mainFrame"a> Page2<br>

</body>

</html>

NOTE: e mainHome.htm, page1.htm and page2.htm all are target to the "mainFrame" that we have define on the frame.htm [above] code. So that when you click the above link, those pages will open on the mainFrame.

Different target:
http://www.w3schools.com/tags/att_a_target.asp


3. Now you create your pages as define on the Navigation.htm file:

example:
 $ vi mainHome.htm:

<html>
<head>
</head>

<body>
    This is the Home page.
</body>
</head>

example:
$ vi page1.htm

<html>
<head>
</head>

<body>
    This is page1.
</body>
</head>


example:
$vi page2.htm

<html>
<head>
</head>

<body>
    This is page2.
</body>
</head>


SnapShot:


No comments:

Post a Comment