Can someone fix this watermark cut-n-past script by Paul Anderson to work with a Transitional Doctype

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rfr

    Can someone fix this watermark cut-n-past script by Paul Anderson to work with a Transitional Doctype

    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"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta name="GENERATOR " content="Micros oft FrontPage 6.0">
    <meta name="ProgId" content="FrontP age.Editor.Docu ment">
    <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><b r><br><br><br>< br><br><br><br> <br>
    <br><br><br><br ><br><br><br><b r><br><br><br>< br><br><br><br> <br>
    <br><br><br><br ><br><br><br><b r><br><br><br>< br><br><br><br> <br>
    <br><br><br><br ><br><br><br><b r><br><br><br>< br><br><br><br> <br>
    <br><br><br><br ><br><br><br><b r><br><br><br>< br><br><br><br> <br>
    <HR style="color:#0 00000;" 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:we bmaster@wgtn.ne t">Webmaster@wg tn.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="JavaS cript1.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.wa terMark.style =
    document.all.wa terMark;

    wMark = document.all.wa terMark.style;
    wMark.width = markW;
    wMark.height = markH;
    navDOM = window.innerHei ght; // Nav DOM flag

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

    function wRefresh() {
    wMark.left = posX + (navDOM?pageXOf fset:document.b ody.scrollLeft) ;
    wMark.top = posY + (navDOM?pageYOf fset:document.b ody.scrollTop);
    }

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

    window.onload=m arkMe; // safety for Mac IE4.5

    //-->

    </script>
    </body>
    </html>
    =============== ===============


  • rfr

    #2
    Re: Can someone fix this watermark cut-n-past script by Paul Anderson to work with a Transitional Doctype

    This revised version that I found does work with a transitional DocType
    =============== =============== =============== =
    <script type="text/javascript">

    /*
    Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
    Script featured on/available at http://www.dynamicdrive.com/
    This notice must stay intact for use
    */

    //Enter "frombottom " or "fromtop"
    var verticalpos="fr ombottom"

    if (!document.laye rs)
    document.write( '</div>')

    function iecompattest(){
    return (document.compa tMode && document.compat Mode!="BackComp at")?
    document.docume ntElement : document.body
    }

    function JSFX_FloatTopDi v()
    {
    var startX = 3,
    startY = 480;
    var ns = (navigator.appN ame.indexOf("Ne tscape") != -1);
    var d = document;
    function ml(id)
    {
    var el=d.getElement ById?d.getEleme ntById(id):d.al l?d.all[id]:d.layers[id];
    if(d.layers)el. style=el;
    el.sP=function( x,y){this.style .left=x+"px";th is.style.top=y+ "px";};
    el.x = startX;
    if (verticalpos==" fromtop")
    el.y = startY;
    else{
    el.y = ns ? pageYOffset + innerHeight : iecompattest(). scrollTop +
    iecompattest(). clientHeight;
    el.y -= startY;
    }
    return el;
    }
    window.stayTopL eft=function()
    {
    if (verticalpos==" fromtop"){
    var pY = ns ? pageYOffset : document.body.s crollTop;
    ftlObj.y += (pY + startY - ftlObj.y)/8;
    }
    else{
    var pY = ns ? pageYOffset + innerHeight : iecompattest(). scrollTop +
    iecompattest(). clientHeight;
    ftlObj.y += (pY - startY - ftlObj.y)/8;
    }
    ftlObj.sP(ftlOb j.x, ftlObj.y);
    setTimeout("sta yTopLeft()", 10);
    }
    ftlObj = ml("divStayTopL eft");
    stayTopLeft();
    }
    JSFX_FloatTopDi v();
    </script>
    =============== =============== =============== =====
    "rfr" <rfrohrer@iw.ne twrote in message
    news:DJKdnWftN4 ouKdjVnZ2dnUVZ_ u-dnZ2d@prairiewa ve.com...
    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"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta name="GENERATOR " content="Micros oft FrontPage 6.0">
    <meta name="ProgId" content="FrontP age.Editor.Docu ment">
    <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><b r><br><br><br>< br><br><br><br> <br>
    <br><br><br><br ><br><br><br><b r><br><br><br>< br><br><br><br> <br>
    <br><br><br><br ><br><br><br><b r><br><br><br>< br><br><br><br> <br>
    <br><br><br><br ><br><br><br><b r><br><br><br>< br><br><br><br> <br>
    <br><br><br><br ><br><br><br><b r><br><br><br>< br><br><br><br> <br>
    <HR style="color:#0 00000;" 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:we bmaster@wgtn.ne t">Webmaster@wg tn.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="JavaS cript1.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.wa terMark.style =
    document.all.wa terMark;
    >
    wMark = document.all.wa terMark.style;
    wMark.width = markW;
    wMark.height = markH;
    navDOM = window.innerHei ght; // Nav DOM flag
    >
    function setVals() {
    barW = 0; // scrollbar compensation for PC Nav
    barH = 0;
    if (navDOM) {
    if (document.heigh t innerHeight) barW = 20;
    if (document.width innerWidth) barH = 20;
    } else {
    innerWidth = document.body.c lientWidth;
    innerHeight = document.body.c lientHeight;
    }
    posX = ((innerWidth - markW)-barW) * (markX/100);
    posY = ((innerHeight - markH)-barH) * (markY/100);
    }
    >
    function wRefresh() {
    wMark.left = posX + (navDOM?pageXOf fset:document.b ody.scrollLeft) ;
    wMark.top = posY + (navDOM?pageYOf fset:document.b ody.scrollTop);
    }
    >
    function markMe() {
    setVals();
    window.onresize =setVals;
    markID = setInterval ("wRefresh()",m arkRefresh);
    }
    >
    window.onload=m arkMe; // safety for Mac IE4.5
    >
    //-->
    >
    </script>
    </body>
    </html>
    =============== ===============
    >

    Comment

    Working...