Basic HTML version of Foils prepared 11 March 99

Foil 66 Calculating Geometry on Screen

From Overview of JavaScript II -- From Cookies to Dynamical HTML CPS616 Technologies of the Information Age -- Spring Semester 99. by Geoffrey C. Fox (Tom Scavo)

DHTML Utilities and Second DHTML Example in html and text for Foil 66
var pointerheight = WW_getlayerheight(WW_pointerlayer);
var localy = WW_getlayertop(WW_pointerlayer) + pointerheight;
var localx = WW_getlayerleft(WW_pointerlayer);
var messageheight = WW_getlayerheight(WW_pointermessageobject);
var messagewidth = WW_getlayerwidth(WW_pointermessageobject);
var windowwidth = WW_getwindowwidth();
var windowheight = WW_getwindowheight();
if( localx + messagewidth > windowwidth)
localx = windowwidth - messagewidth;
if( localy + messageheight > windowheight)
localy = WW_getlayertop(WW_pointerlayer) - messageheight;
This code, uses sizes of window, pointer and mouse over message to position latter so it always visible
  • Initial choice is starting below bottom left corner of pointer
  • If no room to right, the shift so ends at window right boundary
  • If no room below pointer, place above it
Window Width and Height



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Mar 11 1999