Should colleges snoop student computers
E-learning subscriptions

Formatting page for printing

WEB REFERENCE -- It's better to be able to show three columns through a template while knowing people can get the best print job from the page by using a "PRINT" button enabled by JavaScript. We can write JavaScript code that will create Internet Explorer's DeviceRect and LayoutRect elements on the fly.

The function addFirstPage() assembles the document's first page from one LayoutRect element which is within a DeviceRect element. The only trick is how to assemble these opening and closing tags in a single string variable, newHTML. Be strict with the quotes: use double quotes for newHTML's substrings and single quotes for original quotes in the LayoutRect and DeviceRect elements.


function addFirstPage() {
newHTML = " "MEDIA='print' CLASS='masterstyle'>";
newHTML += " "ONLAYOUTCOMPLETE='onPageComplete()' NEXTRECT='layoutrect2'" +
"CLASS='contentstyle'/>";
newHTML += "
";

devicecontainer.insertAdjacentHTML("afterBegin", newHTML);
}


Yhunda Siran -- "Formatting the First Page for Printing using JavaScript"
Web Reference -- "Print templates, part I
x_ref143wd

Comments