spacer
Yehuda Shiran August 10, 2001
Detecting A Page Completion
Tips: August 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

When we write JavaScript code that creates the DeviceRect and LayoutRect elements on the fly, we usually want to know when the rendered page is done. This is the motivation to add the OnLayoutComplete attribute to the LayoutRect element. The event LayoutComplete fires when the LayoutRect element stops rendering its content. The reason for this can be twofold: either the source is exhausted or the LayoutRect element is overflowed by a longer source.

Let's see how to use the event handler OnLayoutComplete. The function addFirstPage() assembles the document's first page from one LayoutRect element which is within a DeviceRect element. Notice the event handler ONLAYOUTCOMPLETE = 'onPageComplete()'. When the page is done rendering, we call the function onPageComplete() to continue rendering the remainder of the document. Try it. Here is the function addFirstPage():

function addFirstPage() {
  newHTML  = "<IE:DEVICERECT ID='devicerect1' MEDIA='print' CLASS='masterstyle'>";
  newHTML += "<IE:LAYOUTRECT ID='layoutrect1' CONTENTSRC='010808.html'" +
             "ONLAYOUTCOMPLETE='onPageComplete()' NEXTRECT='layoutrect2'" +
             "CLASS='contentstyle'/>";
  newHTML += "</IE:DEVICERECT>";

  devicecontainer.insertAdjacentHTML("afterBegin", newHTML);
}
We'll cover the function onPageComplete() tomorrow. For more information on print templates, go to Column 89, Print Templates, Part I.


People who read this tip also read these tips:

Look for similar tips by subject:

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