| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Account Closed Join Date: Oct 2005 Location: India
Posts: 633
![]() ![]() ![]() | Site Logo Script Step 1: Choose from one of the following files and save it into your webpage directory (either by clicking it, or clicking it with the shift key depressed for NS users). Which file to download depends on how you want the logo positioned. The below demo uses the first file: //edit the below 5 steps // 1) substitute 116 and 42 with the width and height of your logo image, respectively ????: NamePros.com http://www.namepros.com/code/154726-site-logo-script.html var logowidth=116 var logoheight=42 var logoimage=new Image(logowidth,logoheight) // 2) change the image path to reflect the path of your logo image logoimage.src="../dynamic2.gif" // 3) Change url below to the target URL of the logo var logolink="http://yoursitename.com" // 4) change the alttext variable to reflect the text used for the "alt" attribute of the image tag var alttext="THIS LOGO IS COOL" // 5) Finally, below variable determines the duration the logo should be visible after loading, in seconds. If you'd like the logo to appear for 20 seconds, for example, enter 20. Entering a value of 0 causes the logo to be perpectually visible. var visibleduration=12 // Optional parameters var Hoffset=10 //Enter logo's offset from right edge of window (edit only if you don't like the default off set) var Voffset=0 //Enter logo's offset from top edge of window (edit only if you don't like the default offset) ????: NamePros.com http://www.namepros.com/showthread.php?t=154726 ///////////////////////////Do not edit below this line///////////////////////// var ie=document.all&&navigator.userAgent.indexOf("Oper a")==-1 var watermark_obj=ie? document.all.watermarklogo : document.getElementById? document.getElementById("watermarklogo") : document.watermarklogo function insertimage(){ if (ie||document.getElementById) watermark_obj.innerHTML='<a href="'+logolink+'"><img src="'+logoimage.src+'" width="'+logowidth+'" height="'+logoheight+'" border=0 alt="'+alttext+'"></a>' else if (document.layers){ watermark_obj.document.write('<a href="'+logolink+'"><img src="'+logoimage.src+'" width="'+logowidth+'" height="'+logoheight+'" border=0 alt="'+alttext+'"></a>') watermark_obj.document.close() } } function positionit(){ var dsocleft=ie? document.body.scrollLeft : pageXOffset var dsoctop=ie? document.body.scrollTop : pageYOffset var window_width=ie? document.body.clientWidth : window.innerWidth-20 if (ie||document.getElementById){ watermark_obj.style.left=parseInt(dsocleft)+parseI nt(window_width)-logowidth-Hoffset watermark_obj.style.top=parseInt(dsoctop)+5+Voffse t } else if (document.layers){ watermark_obj.left=dsocleft+window_width-Hoffset-logowidth watermark_obj.top=dsoctop+window_height+5+Voffset } } function hidewatermark(){ if (document.layers) watermark_obj.visibility="hide" else watermark_obj.style.visibility="hidden" clearInterval(watermarkinterval) } function beingwatermark(){ watermarkinterval=setInterval("positionit()",50) insertimage() if (visibleduration!=0) setTimeout("hidewatermark()",visibleduration*1000) } if (ie||document.getElementById||document.layers) window.onload=beingwatermark Step 2: Insert the below inside the <body> section of the pages, in open space (not contained inside any tag, such as <table> etc). Be sure to change the name "staticlogo.js to match the file you've downloaded above: div id="watermarklogo" style="position:absolute;"></div> <script src="staticlogo.js"> </script> Configuring the logo: All configurations to the script are made inside the external file you saved in Step 1. There are in total 5 variables you need to configure. As mentioned above, since the script itself is inside an external js file, you can easily update the logo image/link whenever you wish simply by changing two lines of code, and the changes will instantly be applied to all the pages that use the logo script. You can even temporarily disable the logo by commenting out the last 2 lines of code inside the file (just put it back when you want the logo re-enabled). Enjoy the script! |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Great Scripts for Sale With Resale Rights! | Zeeble | Scripts For Sale | 20 | 01-04-2006 01:39 AM |
| Huge Xmas script pack sale $5.00 | KPR | Scripts For Sale | 1 | 12-08-2005 06:25 PM |