Support Forums

Full Version: [javascript] Logo Branding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Credits and Source: http://jsmadeeasy.com/

Name: Logo Branding
Description: Have you seen the floating logo on Geocities sites? How would you like to have your own logo floating in the corner of your site? This script does just that!
Snippet:

Insert into <HEAD>
Code:
<SCRIPT LANGUAGE="JavaScript">
function setVariables() {
imgwidth=235;
imgheight=19;
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);
}
</script>

Insert into <BODY>
Code:
<!-- STEP TWO: Add this onLoad event handler to the BODY tag    -->

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

<div id="branding" style="position:absolute; visibility:show; left:235px; top:-50px; z-index:2">
<table width=10 bgcolor=#ffffff><td>
<a href="http://javascript.internet.com" onmouseover="window.status='The JavaScript Source';return true" onmouseout="window.status='';return true"><center><img src="http://javascript.internet.com/img/branding/branding.gif" width="235" height="19" border="0"></center></a></font></td>
</table>
</div>

Thankyou for reading. Be happy always Smile