Broad Network


Sectioning Content Elements in DOM

HTML Grouping and Sectioning Content Elements in DOM – Part 2

Foreword: In this part of the series I talk about HTML sectioning content elements in DOM.

By: Chrysanthus Date Published: 5 Aug 2015

Introduction

This is part 2 of my series, HTML Grouping and Sectioning Content Elements in DOM. In this part of the series I talk about HTML sectioning content elements in DOM. Sectioning content elements are the body, article, section, nav and aside elements. The main element can be compared to an article element for a large article, but the main element is a grouping element and not a sectioning content element. Elements that work with the sectioning content elements are the heading elements (h1 – h6), the header element, the footer element and the address element.

All the sectioning content elements and elements that work with them use the HTMLElement interface. However, the body element has extra attributes, which are event attributes. I spend the rest of this tutorial talking about the body element event attributes.

An Event
An event is an occurrence based on time.  The names of the body element events are:  onunload, onafterprint, onbeforeprint, onbeforeunload, onhashchange, onmessage, onoffline, ononline, onpagehide, onpageshow, onpopstate, onstorage.

You type an event attribute in the same way that you type any other attribute in the start tag of the element. However, the value of an event attribute is an ECMAScript function call to a user-defined function that will handle the event.

The onunload Event
When you close a web page either by closing the browser or closing the window tab, the page unloads from memory; that is an unload event. onunload means  on-unload. This event is triggered when the web page unloads. Assume that you have the body start tag as,

    <body onunload=evFn()>

and in the ECMAScript you have

        function evFn()
            {
                alert('do some house keeping');
            }      
when the page unloads, the alert box should display, 'do some house keeping'.


Now, the major browsers have not yet implemented the body event attributes; so I will stop here and come back to add the tutorial, later.

Chrys

Related Links

DOM Basics for HTML
DOM Event Basics for HTML
HTML Text and Other Elements in DOM
HTML Grouping and Sectioning Content Elements in DOM
DOM and HTML Embedded Content
HTML Canvas 2D Context
More Related Links
PurePerl MySQL API
Major in Website Design
Web Development Course
Producing a Pure Perl Library

BACK

Comments

Become the Writer's Fan
Send the Writer a Message