Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Adding the Change Page Functionality

April 1, 1998

Adding the Change Page functionality

The next and previous page functions are added next. These use a switch statement to control which content page is loaded next, depending on which page is currently loaded. The current page is maintained in a global variable. The code for the next and previous page functions is shown in the following code block:

LAYERWIDTH = 500;
current_page = "part1.htm";

// pull in "next" page of article
function next_page() {
   switch(current_page) {
	case "part1.htm" :
		current_page = "part2.htm";
		break;
      case "part2.htm" :
		current_page = "part3.htm";
		break;
      default :
		current_page = "part1.htm";
	}
   wdvlObjs["content"].objChangeSource(current_page,LAYERWIDTH);
}

// pull in previous page of article
function prev_page() {
   switch(current_page) {
	case "part1.htm" :
		current_page = "part3.htm";
		break;
      case "part2.htm" :
		current_page = "part1.htm";
		break;
      default :
		current_page = "part2.htm";
	}
wdvlObjs["content"].objChangeSource(current_page,LAYERWIDTH);
}

Notice that the width of the layer is also maintained as a global constant value, and passed to the new object method.

If the page were tested at this point, the content would load according to which page was accessed, and would wrap correctly for both browsers. However, there would be a major difference in the output of the page for both browsers in that Microsoft clips content to the frame object and automatically provides left-right and top-down scrollbars for the frame. Netscape, however, wraps the content and displays all of the content along the length of the content, and the Web page reader needs to scroll the browser window. As this is not the effect I want, I need to add functionality to the Netscape layer to clip the content to the layer's specified length and to provide code-driven scrolling for the content. This also means that one more extension needs to be added to the cross-browser objects to control object clipping. The new extension is discussed in the next section.

Adding objChangeSource to the Cross-Browser Objects
Cross-Browser Objects: Creating a "load on demand" Web Page
Adding Clipping to the Cross-Browser objects



Up to => Home / Authoring / DHTML / CB / LOD




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers