JavaScript
— 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
—
JavaScript
— The World’s Most Misunderstood Programming Language — According to Douglas Crockford, JavaScript, aka Mocha, aka LiveScript, aka JScript, aka ECMAScript, is one of the world’s most popular programming languages. Virtually every personal computer in the world has at least one JavaScript interpreter installed on it and in active use. JavaScript’s popularity is due entirely to its role as the scripting language of the WWW.
Despite its popularity, few know that JavaScript is a very nice dynamic object-oriented general-purpose programming language. How can this be a secret? Why is this language so misunderstood?
Here is more of what Douglas Crockford has to say on the matter of JavaScript .. Read More ..
Leave a Reply
Your email is safe with us.
You must be logged in to post a comment.