spacer

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

home / experts / javascript / column92


Print Templates, Part III: HeaderFooter

Technical Lead
Thomson Reuters (Markets) LLC
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume
Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?


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, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


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