473,486 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1686
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
1105
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
1636
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
2940
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
1497
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
1570
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
1505
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
3023
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
1815
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
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.