spacer

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

home / experts / javascript / column92


Print Templates, Part III: HeaderFooter

Product Designer
Aquent
US-WA-Redmond

Justtechjobs.com Post A Job | Post A Resume
Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

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.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

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

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags


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