UNIT II
Frames : Introduction
Frames divide a single browser window into multiple, independent regions, each of which can display a different HTML document. You begin by created FRAMESET document, which sets up the "layout" by establishing the number of frames, their position and other characteristics.
This frameset document is structural only and does not contain any of the content that will appear on the final web page. It does however, specify a URL reference for each frame, which will be the HTML document, or "normal" web page that will be displayed within it.
Hyperlinks in one frame can update the contents of another frame through the use of the TARGET attribute.
Frames are controversial, however. Like many other web elements, such as background graphics, animations, and font colors, they can be poorly handled and often irritating, so give it some careful thought before you use them.
Advantages of Frames
1. They allow parts of the screen to remain static while other parts scroll. This can be useful for navigation menus or logos that you don't want to scroll off the screen.
2. They can be handy when you want the user to be able to view a number of images chosen from a long list. 2. You can introduce material from different servers on the same page, simply by assigning the appropriate URL's.
Disadvantages of Frames
1. Navigating through a framed site can be challenging for many users, as the forward and back buttons do not work as expected.
2. Bookmarking a framed site is difficult, as only the top level document is noted. Users have the ability to work around this by opening the frame of interest in a new window and bookmarking it, but they may not aware of that.
3. Since a framed page is loading more than one URL, it may load more slowly, particularly if calling upon different servers.
4. Frames present problems for search engine indexing. That said, let's get on with the exercise. The table below simulates a common layout on the web, consisting of a banner across the top of the browser window, with the remainder of the page divided into two columns. See example.
For this exercise we need to create 4 documents, all within the same folder:
1. "frameset.html" - the frameset document itself. 2. "banner.html" - the banner that runs across the top of the browser window. 3. "column1.html - the page that will display in column one. This page will contain a hyperlink that will load an external web page into column two. 4. "column2.html" - the page that will display in column two when the frameset is first viewed. This page will be replaced by new content when the user clicks on the hyperlink in column one.
Banner
Column One Column Two frameset.html
Create the document head as usual, but without a body
The first frameset defines the number of rows in the document and their height. This example creates two rows. The top row is 40 pixels high and the second can
Close the HTML tag, note there is no body tag to close2. banner.html
3. column1.html
4. column2.html
The
HTML frameset tag and element 1. HTML frameset element defines a window within which subwindows can exist in the form of frames.
2. frame element starts with
3. A number of frames (subwindows) as well as framesets can be defined within frameset element.
Syntax
The element he HTML Inline Frame element (
This will produce the following result − Video Attribute Specification
The HTML5 video tag can have a number of attributes to control the look and feel and various functionalities of the control −
Sr.No. Attribute & Description
autoplay 1 This Boolean attribute if specified, the video will automatically begin to play back as soon as it can do so without stopping to finish loading the data.
autobuffer 2 This Boolean attribute if specified, the video will automatically begin buffering even if it's not set to automatically play.
controls 3 If this attribute is present, it will allow the user to control video playback, including volume, seeking, and pause/resume playback.
height 4 This attribute specifies the height of the video's display area, in CSS pixels. loop 5 This Boolean attribute if specified, will allow video automatically seek back to the start after reaching at the end.
preload 6 This attribute specifies that the video will be loaded at page load, and ready to run. Ignored if autoplay is present.
poster 7 This is a URL of an image to show until the user plays or seeks.
src 8 The URL of the video to embed. This is optional; you may instead use the
width 9 This attribute specifies the width of the video's display area, in CSS pixels.
Embedding Audio
HTML5 supports
This will produce the following result − Audio Attribute Specification
The HTML5 audio tag can have a number of attributes to control the look and feel and various functionalities of the control −
Sr.No. Attribute & Description
autoplay 1 This Boolean attribute if specified, the audio will automatically begin to play back as soon as it can do so without stopping to finish loading the data.
autobuffer 2 This Boolean attribute if specified, the audio will automatically begin buffering even if it's not set to automatically play.
controls 3 If this attribute is present, it will allow the user to control audio playback, including volume, seeking, and pause/resume playback.
loop 4 This Boolean attribute if specified, will allow audio automatically seek back to the start after reaching at the end.
preload 5 This attribute specifies that the audio will be loaded at page load, and ready to run. Ignored if autoplay is present. src 6 The URL of the audio to embed. This is optional; you may instead use the
Handling Media Events
The HTML5 audio and video tag can have a number of attributes to control various functionalities of the control using JavaScript −
S.No. Event & Description
1 abort This event is generated when playback is aborted.
canplay 2 This event is generated when enough data is available that the media can be played.
ended 3 This event is generated when playback completes.
error 4 This event is generated when an error occurs.
loadeddata 5 This event is generated when the first frame of the media has finished loading.
loadstart 6 This event is generated when loading of the media begins.
pause 7 This event is generated when playback is paused. play 8 This event is generated when playback starts or resumes.
progress 9 This event is generated periodically to inform the progress of the downloading the media.
ratechange 10 This event is generated when the playback speed changes.
seeked 11 This event is generated when a seek operation completes.
seeking 12 This event is generated when a seek operation begins.
suspend 13 This event is generated when loading of the media is suspended.
volumechange 14 This event is generated when the audio volume changes.
waiting 15 This event is generated when the requested operation (such as playback) is delayed pending the completion of another operation (such as a seek).
Following is the example which allows to play the given video − Live Demo