Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

52 CHAPTER 2 Getting started with HTML5


Passing parameters to an object
Because the <object> tag can represent any object, the <param> tag enables you to pass
data to the object. You can use one or more <param> tags to pass parameters to plug-ins
that have been embedded with the <object> tag. The <param> tags must be before any
alternate text that is within the <object> element.
The <param> tag has a name and a value attribute, and both are required for each
<param> tag. The following is an example of using a <param> tag with an audio file to keep
the audio file from automatically playing when the page is loaded.
<object data="tada.wav">
<param name="autoplay" value="false" />
</object>

Using the object tag to create a browser context
In addition to using the <iframe> tag to create a nested browser context, you can use the
<object> tag, but this is not supported on all browsers, so you should use the <iframe> tag.

Lesson summary


■■You can use the <iframe> element to provide reuse of HTML by embedding an HTML
document in your current HTML document.
■■Use the sandbox attribute on the <iframe> tag to help prevent malware and annoy-
ances such as pop-ups from being introduced when the content is embedded in your
HTML page.
■■Use the seamless attribute on the <iframe> tag to indicate that the source content is to
be rendered to appear as though it’s part of the containing document.
■■The <a> tag creates a hyperlink to either an external HTML document or an internal
location in the current document. The <a> tag can also be used to send email
messages.
■■The <img> element is a void element and is used to add an image reference to your
HTML document.
■■JPG is best for displaying photos on HTML pages due to its compression, GIF is best
for small images with transparency and embedded animations, PNG is best for storage
due to lossless compression during editing sessions, and SVG is best for drawings due
to its vector drawing scalability.
■■You can create a clickable image map by using the <map> and <area> elements.
■■You can use the <embed> tag to provide simple content embedding.
■■You can use the <object> tag to provide content embedding with greater flexibility
because it can have nested <param> elements.
Free download pdf