Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with watermark

Status
Not open for further replies.

RexJacobus

Programmer
Dec 10, 2001
47
0
0
NZ
Here is the code (which was primarily generated from someone else's website). In Mozilla this creates a watermark in the location I want but at 100% opacity so you can't see through it. In IE, the opacity is how I want it but the watermark is aligned left.

Any ideas, I'm not Mr. Javascript but it looks ok to me.

-------------
<div align="center" id="watermark" style="position: absolute; left:0px; top:0px; z-index:20; visibility:hidden;width:500px;">
<img src=" width="500" height="500" border="0" alt="Watermark" style="filter: alpha(opacity=15); width:500px; height:500px;"></div>

<script language="javascript">
function SetStatic(){
if(document.all){watermark.style.pixelTop=document.body.scrollTop+document.body.clientHeight-800;}
else if(document.layers){eval(document.watermark.top=eval(window.pageYOffset+window.innerHeight-800));}
else if(document.getElementById && !document.all){document.getElementById("watermark").style.top=window.pageYOffset+window.innerHeight-800;}
}

setInterval("SetStatic()",1);

function position() {
if(document.all){
watermark.style.pixelLeft = document.body.clientWidth/2-250;
setTimeout('watermark.style.visibility = "visible"', 50);}
else if(document.layers){
document.watermark.left+=window.innerWidth/2-250;
setTimeout('document.watermark.visibility = "visible"', 50);}
else if(document.getElementById && !document.all){
document.getElementById("watermark").style.left=window.innerWidth/2-250;
setTimeout('document.getElementById("watermark").style.visibility = "visible"', 50);}
}//end function

position();
</script>
-------------------
thanks,
Rex
 
Hi

[ul]
[li]There is no [tt]filter[/tt] in the CSS. That is Explorer's own invention and will work only in Explorer.[/li]
[li]Using [tt]document.all[/tt] is deprecated.[/li]
[li]Using [tt]document.layers[/tt] is deprecated.[/li]
[li]The whole idea of client-side watermark sounds stupid.[/li]
[li]I see no reason of using JavaScript instead of CSS positioning.[/li]
[/ul]
Anyway. To make the opacity work in more browsers :
Code:
<img src="[URL unfurl="true"]http://www.site.com/images/1Tile.gif"[/URL] width="500" height="500" border="0" alt="Watermark" style="opacity: 0.15; -moz-opacity: 0.15; -khtml-opacity: 0.15;-ms-filter: alpha(opacity=15); filter: alpha(opacity=15); width:500px; height:500px;">

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top