Understanding Frames in HTML: Structure and Navigation
This chapter introduces the concept of frames in HTML, which allows a webpage to be divided into multiple regions, each displaying different content. For example, a page can be split into three sections, displaying different HTML files. The process involves creating a frameset, specifying the layout with COLS and ROWS attributes, and linking frames through the TARGET attribute. This setup enables dynamic content presentation where clicking links in one frame can affect the display in another, enhancing user navigation across different sections of a site.
Understanding Frames in HTML: Structure and Navigation
E N D
Presentation Transcript
Chapter 8 Frames in HTML
Intro. • What are frames: • A page can be divided into set of regions each of which can display and present a different page. • For example: we can divide a page into 3 different parts. Part one will display a file named for example file1.html, part 2 displays file2.html, and part 3 displays file3.html. • This can be done by frames. • The coordinator file (the one that has the frameset MUST NOT contain <body> tag.
Cont. • To coordinate the individual HTML files, you need a main HTML file telling the browser how many frames and in what orientation they are. <HTML> <TITLE>First Frame Page</TITLE> <FRAMESET COLS="50%,50%"> <FRAME SRC=”left.htm"> <FRAME SRC=”right.htm"> </FRAMESET> </HTML>
Cont. • FRAMESET: starts a frame page • COLS: Set the coming specified frames in columns • FRAME SRC: denotes the source of the frame pages • Similarly, you can have ROWS for horizontal splitting
Cont. • Suppose we have two frames (left frame and right frame). We want to display a page on the right frame upon a click on the left frame (with the <A> command) • We have to set the NAME in the <FRAME> and set the TARGET in the <A> command <HTML> <TITLE>First Frame Page</TITLE> <FRAMESET COLS="50%,50%"> <FRAME NAME=“LEFT” SRC=”left.htm"> <FRAME NAME=“RIGHT” SRC=”right.htm"> </FRAMESET> </HTML> • In the anchor command on the left page, we specify what to display on the RIGHT Frame upon the mouse click: <A HREF="http://www.hkma.org.hk” TARGET=”RIGHT">