spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column92


Print Templates, Part III: HeaderFooter

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs


Assembling the Header and Footer

The main functionality of the HeaderFooter behavior is to synthesize the HTML of the header and footer. The HTML for the header is in the HeaderFooter's htmlHead property. The HTML for the footer is in its htmlFoot property. The inputs to this synthesis process are all other HeaderFooter properties. First and foremost are the instructions. These are strings that specify what should be assembled in htmlHead and htmlFoot, and how they should be assembled. These strings are in the textHead and textFoot properties. Other properties are also participating: url, title, and pageTotal.

We insert the header and footer HTML in two DIV elements, newHeader and newFooter. Once they are assembled, we insert the header at the beginning of the page, and the footer before the end of the page. The following addHeaderAndFooterToPage() function creates the HTML for the header and the footer, and inserts them into a page:

function addHeaderAndFooterToPage(pageNum) {
  newHeader = "<DIV CLASS='headerstyle'>" +
    myheaderfooter.htmlHead + "</DIV>";
  newFooter = "<DIV CLASS='footerstyle'>" +
    myheaderfooter.htmlFoot + "</DIV>";

  document.all("DEVICERECT" +
    pageNum).insertAdjacentHTML("afterBegin", newHeader);
  document.all("DEVICERECT" +
    pageNum).insertAdjacentHTML("beforeEnd", newFooter);
}

Next: How to add headers and footers while rendering


http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: September 10, 2001
Revised: September 10, 2001

URL: http://www.webreference.com/js/column92/4.html