Board index » javascript » Can someone fix this watermark cut-n-past script by Paul Anderson to work with a Transitional Doctype
|
rfr
Registered User |
Can someone fix this watermark cut-n-past script by Paul Anderson to work with a Transitional Doctype
2008-06-04 05:16:05 AM
Apparently the Transitional Doctype kills this script because the script does not make proper use of units like "px". It works well without a doctype statement. But once someone adds a transitional doctype, the js script no longer works. Can someone familiar with javascript bring it up-to-date so that it works with current doctypes and post it here for others to make use of? The whole HTML document including the js scrip follows ( this was a footer on a section of my comunity web site: I added the doctype and "<br>" codes to make a test platform of it); =================================================================== <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 6.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <!-- Standard Wgtn.net 1st Level Footer --> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <HR style="color:#000000;" width="75%"> <div align="center"> <center> <Table style="border-collapse: collapse; border-color:#111111;" cellpadding="0" cellspacing="0"> <TR> <TD vAlign="top"> <A Href="../index.htm"> <Img src="images/wgtnhome.jpg" alt="Wgtn Home" border="0" width="75" height="34" hspace="10"></A> </TD> <TD> <center> <Font size="-1" face="Arial"> Questions, needs, and issues on Design or Function should be addressed to the <A Href="mailto:webmaster@wgtn.net">Webmaster@wgtn.net</A> <BR> Designed by Rohrer & Associates 2006 </Font> </center> </TD> </TR> </Table> </center> </div> <DIV id="waterMark" style="position:absolute"><a href="#" onClick="window.scrollTo(0,0)"> <img src="images/top0112.gif" border="0" width="80" height="42" alt=""></a></DIV> <script type="text/javascript" language="JavaScript1.2"> <!-- // Based on watermark script by Paul Anderson, CNET Builder.com. All rights reserved. markW = 90; // pixels wide markH = 40; // pixels high markX = 99; // percent right markY = 99; // percent down markRefresh = 50; // 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> </body> </html> ============================== - |
