• Home
  • Services
    • Web Design Updates
    • Website Development
    • eCommerce Web Design
    • Responsive Website Design
    • Multimedia Website Design
    • Search Engine Optimization
    • Website Maintenance Services
  • WebLog
    • Development
    • Search Engine Optimization
    • Coding
    • Operating Systems
    • Media
    • News
  • Webmaster Tools
    • CSS Button Generator
    • RGB and HEX Color Charts
    • Meta Tag Generator
    • Robots.txt Generator
    • Password Encryption
  • cPanel
    • cPanel Interface
    • cPanel Homepage
    • Add Domain Names
    • Email Accounts and Settings
    • cPanel File Manager
    • cPanel Databases
    • cPanel Stats and Metrics
  • Web Hosting
    • Basic Web Hosting
    • Standard Web Hosting
    • Premium Web Hosting
    • White Label Hosting
  • Computer Repair
Web Hosting Login
Login

Login
Central Montana Web Design - ReddWebDev
  • Home
  • Services
    • Web Design Updates
    • Website Development
    • eCommerce Web Design
    • Responsive Website Design
    • Multimedia Website Design
    • Search Engine Optimization
    • Website Maintenance Services
  • WebLog
    • Development
    • Search Engine Optimization
    • Coding
    • Operating Systems
    • Media
    • News
  • Webmaster Tools
    • CSS Button Generator
    • RGB and HEX Color Charts
    • Meta Tag Generator
    • Robots.txt Generator
    • Password Encryption
  • cPanel
    • cPanel Interface
    • cPanel Homepage
    • Add Domain Names
    • Email Accounts and Settings
    • cPanel File Manager
    • cPanel Databases
    • cPanel Stats and Metrics
  • Web Hosting
    • Basic Web Hosting
    • Standard Web Hosting
    • Premium Web Hosting
    • White Label Hosting
  • Computer Repair

A simple free ad rotation script

A quick and easy way to placed paid ads:

Home DevelopmentA simple free ad rotation script
A simple free ad rotation script

A simple free ad rotation script

October 31, 2015 Posted by Alan Development

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.

Tags: ad rotationadvertisingcodingECMAScriptinternetjavascriptjs folderJScriptMochaLiveScriptweb design
Share
0

About Alan

Changing the world, one lonely line of code at a time -- Specializing in projects that combine beautiful interactive design with intelligent technology.

You also might be interested in

The first scripting languages date back to the 1960's

The first scripting languages date back to the 1960’s

Sep 20, 2015

The first scripting languages date back to the 1960’s and[...]

Demand your data from Google and Facebook

Demand your data from Google and Facebook

Apr 22, 2012

Demand your data from Google and Facebook. Berners-Lee, the British[...]

Free Social Platforms: Are they worth it?

Free Social Platforms: Are they worth it?

Aug 10, 2015

Free Social Platforms: Are they worth it? — It’s hard[...]

Leave a Reply

Your email is safe with us.
Cancel Reply

You must be logged in to post a comment.




video
play-sharp-fill
Link

New England Journal of Medicine

Categories

  • Coding
  • Development
  • Media
  • News
  • Operating Systems
  • Search Engine Optimization

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Send Message
Experience the freedom of the Internet with your own Website Solution. Get Your Free Quote!


- internet web hosting
- linux server
- domain names
- dedicated ip's
- shared web hosting
- dedicated web hosting

Website Development

- forms and email
- jQuery sliders
- photo galleries
- image graphics rendering
- sitemaps xml
- social network integration
- website maintenance

Website Design

- website design
- website redesign
- website development
- ecommerce websites
- content management systems
- website rescue
- small business web design

Contacts

Great Falls, MT 59404
Phone: 406-788-4084
Friday - Sunday
8 AM – 8 PM MST

2025 © ReddWebDev.com

  • Contact
  • About
  • Acceptable Use Policy
  • Privacy
  • Linux for PC’s
Prev Next