spacer

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

home / experts / javascript / column31


Positioning A Scroll Box

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

There are many ways to position a scroll box. You can position it in absolute coordinates, but the desired location may change because of an ad put at the top of the page, for example. In this column we use the GIF method. We place a dummy GIF wherever we want in our page:

<IMG SRC="blank.gif"
        NAME="holdspace" ID="holdspace"
        WIDTH="350" HEIGHT="90"
        STYLE="visibility:hidden; position:relative;">

We then compute the coordinates of this GIF in our scrolling box code:

var holdingImage = document.images["holdspace"];
var canvasLeft = holdingImage.offsetLeft;
var canvasTop = holdingImage.offsetTop;
var canvasWidth = holdingImage.width;
var canvasHeight = holdingImage.height;

and we use these coordinates to set the scroll box, as explained in previous pages.

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

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


Created: December 7, 1998
Revised: December 7, 1998

URL: http://www.webreference.com/js/column31/position.html