Tips
All Tips ]

A permanently displayed image

This JavaScript is used to permanently display an image (for example, your logo) at the lower right of a page, no matter how your visitors move around on this page.

Between <HEAD> and </HEAD>, add the following:

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Randy Bennett (rbennett@thezone.net) -->

<!-- Begin
function setVariables() {
imgwidth=65;  // largeur de l'image
imgheight=45;  // hauteur de l'image
if (navigator.appName == "Netscape") {
horz=".left";
vert=".top";
docStyle="document.";
styleDoc="";
innerW="window.innerWidth";
innerH="window.innerHeight";
offsetX="window.pageXOffset";
offsetY="window.pageYOffset";
}
else {
horz=".pixelLeft";
vert=".pixelTop";
docStyle="";
styleDoc=".style";
innerW="document.body.clientWidth";
innerH="document.body.clientHeight";
offsetX="document.body.scrollLeft";
offsetY="document.body.scrollTop";
   }
}
function checkLocation() {
objectXY="branding";
var availableX=eval(innerW);
var availableY=eval(innerH);
var currentX=eval(offsetX);
var currentY=eval(offsetY);
x=availableX-(imgwidth+30)+currentX;
y=availableY-(imgheight+20)+currentY;
evalMove();
setTimeout("checkLocation()",10);
}
function evalMove() {
eval(docStyle + objectXY + styleDoc + horz + "=" + x);
eval(docStyle + objectXY + styleDoc + vert + "=" + y);
}
// End -->
</SCRIPT>

Then in the <BODY> tag, insert:

<BODY onload="setVariables(); checkLocation();">

Then:

<div id="branding" style="position:absolute; visibility:show; left:235px; top:-50px; z-index:2">
<table width=10 bgcolor=#ffffff><td>
<a href="index.html" onmouseover="window.status='Thank you for visiting me!';return true" onmouseout="window.status='';return true"><center><img src="yourimage.gif" width="65" height="45" border="0"></center></a></font></td>
</table>
</div>

The image in this example measures 65x45, but you can configure it however you want.

Discover all Webmaster tips.