Scrolling HTML Basics, Part III: Setting Up the Pages - | WebReference

Scrolling HTML Basics, Part III: Setting Up the Pages -

Setting Up the Pages

The pages are prepared inside the showAndScroll() and makeSecondPage() functions. The showAndScroll() function creates the first page in Netscape Navigator, by calling fillFirstPage() function, which is explained earlier. The rest of the showAndScroll() function sets the firstPages's left, top, and visibility properties:

function showAndScroll() {
  if (NS4) fillFirstPage();
  if (NS4) {
    firstPage.left = GleftPadding; = 0;
  else { = GleftPadding; = 0;
  eval("firstPage" + styleString).visibility = (NS4) ? "show" : "visible";
  upperPage = firstPage;
  firstPage.onmouseover = stopScrolling;
  firstPage.onmouseout = scrollPages;
  if (NS4) {firstPage.onload = makeSecondPage;}
  else {makeSecondPage();};

Notice the inconsistency between the browsers regarding the call to the makeSecondPage() function. Netscape Navigator requires the first page to load before the second one can be attempted.

The makeSecondPage() function sets up the second page by filling it in Netscape Navigator and then assigning its visibility:

function makeSecondPage() {
  if (NS4) fillSecondPage();
  secondPage.onmouseover = stopScrolling;
  secondPage.onmouseout = scrollPages;
  lowerPage = secondPage;
  eval("secondPage" + styleString).visibility = (NS4) ? "show" : "visible";
  if (NS4) {secondPage.onLoad = launchScroller;}
  else {launchScroller();}

As before, the scroller cannot be launched before the second page is loaded. The actual launching of the scroller is triggered by setting the top coordinate of the second page and then calling the scrollPages() function for moving up the page:

function launchScroller() {
  if (NS4) { = secondPage.clip.height;}
  else { = secondPage.clientHeight;};

Produced by Yehuda Shiran and Tomer Shiran

Created: December 21, 1998
Revised: December 21, 1998