Re: How'd they do that?

by Tom Gallagher <tleeves(at)yahoo.com>

 Date:  Sun, 9 Jul 2000 14:33:07 -0700 (PDT)
 To:  David Clapper <dclapper(at)clioassociates.com>,
hwg-techniques(at)hwg.org
  todo: View Thread, Original

--- David Clapper <dclapper(at)clioassociates.com> wrote:
> Hello all,
> 
> If you go to http://it.stlawu.edu/~physics/ - notice
the "moving dog
> head" in the lower right
> hand corner.  How'd they do that?
> 
----------------
And the answer is:

<!-- ===================== Watermark image
=========================== -->
<P>
<DIV ID="waterMark" STYLE="position:absolute"
ALIGN="center">
<!-- <font color="Maroon" Face="Comic Sans MS, Arial,
Helvetica, sans-serif" Size="-2">SLU
Physics<br>Rules!</font> -->
	<A HREF="stuff/mascots.shtml"
ONMOUSEOVER="window.status='Physics Mascots'; return
true"><IMG SRC="gifs/thor_head_small.gif" BORDER="0"
WIDTH="62" HEIGHT="54" ALT="Thor sez &#147;Fizzux
Rules! Woof!&#148;"></A>
</DIV>
<P>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
// Watermark script by Paul Anderson, CNET
Builder.com. All rights reserved.

markW = 62;       // pixels wide
markH = 54;       // pixels high
markX = 100;      // percent right
markY = 100;      // percent down
markRefresh = 20; // milliseconds

// set common object reference
if (!document.all) document.all = document;
if (!document.all.waterMark.style)
document.all.waterMark.style = document.all.waterMark;

wMark = document.all.waterMark.style;
wMark.width = markW;
wMark.height = markH;
navDOM = window.innerHeight; // Nav DOM flag

function setVals() {
 barW = 0; // scrollbar compensation for PC Nav
 barH = 0;
 if (navDOM) {
  if (document.height > innerHeight) barW = 20;
  if (document.width > innerWidth) barH = 20;
  } else {
  innerWidth = document.body.clientWidth;
  innerHeight = document.body.clientHeight;
  }
 posX = ((innerWidth - markW)-barW) * (markX/100);
 posY = ((innerHeight - markH)-barH) * (markY/100);
 }

function wRefresh() {
 wMark.left = posX +
(navDOM?pageXOffset:document.body.scrollLeft);
 wMark.top = posY +
(navDOM?pageYOffset:document.body.scrollTop);
 }

function markMe() {
 setVals();
 window.onresize=setVals;
 markID = setInterval ("wRefresh()",markRefresh);
 }

window.onload=markMe; // safety for Mac IE4.5

//-->
</SCRIPT>


A very clever java script.  Always check the "view
source".  

Thanks for pointing it out!!

Tom Gallagher


__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail � Free email you can access from anywhere!
http://mail.yahoo.com/

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA