spacer

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

home / experts / javascript / column92


Print Templates, Part III: HeaderFooter

Java Software Engineer / Architect Sr (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume
Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans


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


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger


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