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
1 var pointerheight = WW_getlayerheight(WW_pointerlayer);
2 var localy = WW_getlayertop(WW_pointerlayer) + pointerheight;
3 var localx = WW_getlayerleft(WW_pointerlayer);
4 var messageheight = WW_getlayerheight(WW_pointermessageobject);
5 var messagewidth = WW_getlayerwidth(WW_pointermessageobject);
6 var windowwidth = WW_getwindowwidth();
7 var windowheight = WW_getwindowheight();
8 if( localx + messagewidth > windowwidth)
9 localx = windowwidth - messagewidth;
10 if( localy + messageheight > windowheight)
11 localy = WW_getlayertop(WW_pointerlayer) - messageheight;
12 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
13 Window Width and Height

in Table To:


© 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