<<

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 . It does however, specify a URL reference for each , 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." - 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 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 Frame Example tag.

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 vary in height. Values for height can be specified as an exact number of pixels, as a percentage, or can be variable with the use of an asterisk. Now indicate the source, or URL, of the web page to be displayed in the top row. In this example we'll use the Name=top simply identifies this particular frame. You may name it anything you like. Insert another frameset in the second row and specify two columns this time. Here the variables indicate column width, and like row variables, can be expressed as the number of pixels, as a percentage, or can vary by using as asterisk. In this example we are setting the width of column one at 230 pixels and allowing column two to vary in width. Give the URL source for each column, and name them. Close both framesets. Close the HTML tag, note there is no body tag to close

2. banner.html

Banner Banner

3. column1.html

Column 1 Life Sciences

4. column2.html

Column 2 This is Column 2

The element

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 tag and ends with tag

3. A number of frames (subwindows) as well as framesets can be defined within frameset element.

Syntax

HTML frameset tag example > HTML tutorial | w3resource

The element he HTML Inline Frame element (

Images Audio and Video

HTML5 features include native audio and video support without the need for Flash. The HTML5

Here is the simplest form of embedding a video file in your webpage −

 Ogg − Ogg files with Thedora video codec and Vorbis audio codec.

 mpeg4 − MPEG4 files with H.264 video codec and AAC audio codec. You can use tag to specify media along with media type and many other attributes. A video element allows multiple source elements and browser will use the first recognized format − Live Demo

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 element within the video block to specify the video to embed.

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 element within the video block to specify the video to embed.

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