JavaScript
A simple free ad rotation script may or may not be a solution you would prefer to use on your site these days — I guess it would depend on whether or not you would choose to embed someone elses script, or your own script, into your pages.
If you are the type that prefers to not use remote solutions when it comes to placing paid ads on your site, then this dandy jewel of a script just might do the trick.
First order of business is to bring up your standard text editor, whether it be Notepad or Leafpad, it doesn’t matter — Next you’ll be naming the file ‘ad-rotation.js’ — Copy and paste the code below into it:
—
gfx0=”http://www.yoursite.com/path/to/image.gif”;
lnk0=”http://www.advertiserswebsite.com/”;
alt0=”Advertisers Website”;
gfx1=”http://www.yoursite.com/path/to/image.gif”;
lnk1=”http://www.advertiserswebsite.com/”;
alt1=”Advertisers Website”;
gfx2=”http://www.yoursite.com/path/to/image.gif”;
lnk2=”http://www.advertiserswebsite.com/”;
alt2=”Advertisers Website”;
gfx3=”http://www.yoursite.com/path/to/image.gif”;
lnk3=”http://www.advertiserswebsite.com/”;
alt3=”Advertisers Website”;
gfx4=”http://www.yoursite.com/path/to/image.gif”;
lnk4=”http://www.advertiserswebsite.com/”;
alt4=”Advertisers Website”;
gfx5=”http://www.yoursite.com/path/to/image.gif”;
lnk5=”http://www.advertiserswebsite.com/”;
alt5=”Advertisers Website”;
len=6; // Number of banners
today=new Date();
today=Math.round(today.getTime()/10);
rnd=today%len;
// Edit the below for specific banner size
document.writeln(‘<a href=”‘+eval(“lnk”+rnd)+'” title=”‘+eval(“alt”+rnd)+'” rel=”external”><img src=”‘+eval(“gfx”+rnd)+'” alt=”‘+eval(“alt”+rnd)+'” width=”468″ height=”60″ /><br /></a>’);
—
Once you’ve edited the file above to reflect your paid (or otherwise) ads/links with the designated web addresses and banner sizes (if any) you’ll be saving it to your desktop so that you can load it to your js folder located in your website’s root directory.
Next, place the code below into the page where you want your rotating ads to appear:
—
<script type=”text/javascript” src=”js/ad-rotation.js”></script>
<noscript>JavaScript must be enabled to view this element</noscript>
—
Any questions? — Just let me know — Happy Coding
—
Using Plugins or Scripts for WordPress or Other CMS:
If your site runs on WordPress or another CMS, consider using plugins like “AdRotate Banner Manager”:
AdRotate Banner Manager offers a user-friendly way to manage and rotate ads. You can set up different schedules, geo-targeting, and more, which might be useful if you need more control over ad rotation.
Leave a Reply
Your email is safe with us.
You must be logged in to post a comment.