spacer

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

home / experts / javascript / column95


Print Templates, Part VI: Interactive Margin Settings

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs


The Margin Dashed Line

An important part of the margin manipulations is the dashed line that shows across the page where the margin is. The function ShowHideMargins() switches between showing and hiding the margins. We show the margins by coloring the dashed line black, and we hide them by coloring the lines white. This function is the event handler for the Show Margins/Hide Margins button in the GUI. Here is the button definition:

<INPUT ID="marginbutton" TYPE="BUTTON" VALUE="Hide Margins"
  ONMOUSEUP="ShowHideMargins()">

And here is the event handler:

function ShowHideMargins() {
  if (marginbutton.value == "Show Margins") {
    oMMarkerClass.style.display = "block";
    oContentStyleClass.style.border = "dashed 1 black";
    marginbutton.value = "Hide Margins";
  } else {
      oMMarkerClass.style.display = "none";
      oContentStyleClass.style.border = "dashed 1 white";
      marginbutton.value = "Show Margins";
    }
}

The margin lines pose a difficulty for the printing routine, as we don't want to see the lines in the final printing. For this reason, we hide the lines before printing, and bring them back after. We hide them in the PrintPrep() function:

function PrintPrep() {
  if (oContentStyleClass.style.border = "dashed 1 black")
    reset = true;
  oContentStyleClass.style.border = "dashed 1 white";

  if (layoutrect1.contentDocument.readyState == "complete") {
    PrintNow();
  } else {
      layoutrect1.contentDocument.onreadystatechange =
        PrintWhenContentDocComplete;
    }

  if (reset) oContentStyleClass.style.border = "dashed 1 black";
}

Next: Code Listing


http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: November 22, 2001
Revised: November 22, 2001

URL: http://www.webreference.com/js/column95/7.html