472,986 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,986 software developers and data experts.

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

rfr
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="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><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>
<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:we*******@wgtn.net">We*******@wgtn.ne t</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>
==============================
Jun 27 '08 #1
1 1644
rfr
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="frombottom"

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

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")?
document.documentElement : document.body
}

function JSFX_FloatTopDiv()
{
var startX = 3,
startY = 480;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.a ll[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+"px";this.st yle.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.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
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(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>
==================================================
"rfr" <rf******@iw.netwrote in message
news:DJ******************************@prairiewave. 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="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><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>
<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:we*******@wgtn.net">We*******@wgtn.ne t</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>
==============================

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: S N | last post by:
> I have inserted some javascript on an asp page.the script is for attaching a > tail to the mouse icon on the screen. > When the asp page contains - > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML...
5
by: zaw | last post by:
Hi I am working on implementing this script to shopping cart. Basically, it copies fill the shipping address from billing automatically. I believe one or more syntax is not netscape compatible....
3
by: niconedz | last post by:
Hi The following code works fine in IE but not Firefox. It's a little script that zooms an image and resizes the window to fit. Can anybody tell me what's wrong? Thanks Nico == btw.....
2
by: | last post by:
Simple script won't work. Why? function sendIt(module) { var flagged = document.form1.getElementById("e_flagger").value; if (module == 'test') { alert("Test OK:" + " " + flagged); } <form...
2
by: funkychicken818 | last post by:
This is the script. var reqTopCont; var reqBotCont; function changeTopContent(newUrl) { reqTopCont = false; // branch for native XMLHttpRequest object if (window.XMLHttpRequest) {
16
by: vunet.us | last post by:
Hm... I used to have a function which drags some div element on mousemove. After I added: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://...
14
by: tader | last post by:
so i got script like that <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Drag and Drop</title> <style> #slater { display:block;
2
chunk1978
by: chunk1978 | last post by:
i wrote a custom PHP script last year and everything worked perfectly... recently my webserver upgraded to PHP 5 and now my script doesn't work properly. what the script does is: users fill out...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.