Click here to Skip to main content
12,622,252 members (37,156 online)
Click here to Skip to main content
Add your own
alternative version

Stats

68.9K views
9 bookmarked
Posted

Banner.js

, 14 Oct 2003
Rate this:
Please Sign up or sign in to vote.
An object oriented approach for displaying banners.

Introduction

I was looking for a JavaScript banner solution that allows me to run banners on my web, when I discovered the BarelyFitz JavaScript slideshow. It's the best slideshow script I've seen, and I decided to use if for my banners.

Inheritance

The easiest method to "borrow" somebody else's code, is through inheritance. Using Nicholas C. Zakas's technique makes inheritance in JavaScript a dream:

Object.prototype.extend = function (oSuper) { 
       for (sProperty in oSuper) { 
               this[sProperty] = oSuper[sProperty]; 
       } 
}

function ClassA () { 
} 

function ClassB() { 
       this.extend(new ClassA()); 
}

The Banner Class

The reason I wrote this banner class, was to be able to have two (or more) banners on one page. The banner class acts as a wrapper around the slideshow class and inherits slideshow's methods and properties.

You'll find a demo here.

Prerequisite

BarelyFitz JavaScript slideshow.js.

The code

<HEAD>
<SCRIPT type="text/javascript" src="slideshow.js"></SCRIPT>

Have fun coding.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Per S
Web Developer
Norway Norway
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralNightmare, not a dream Pin
darkoverlordofdata7-Jun-04 4:31
sussdarkoverlordofdata7-Jun-04 4:31 
GeneralAdRotator Pin
adrian7310-Oct-03 0:17
memberadrian7310-Oct-03 0:17 
GeneralRe: AdRotator Pin
Uwe Keim10-Oct-03 3:25
sitebuilderUwe Keim10-Oct-03 3:25 
GeneralRe: AdRotator Pin
adrian7310-Oct-03 4:03
memberadrian7310-Oct-03 4:03 
GeneralRe: AdRotator Pin
Uwe Keim10-Oct-03 4:11
sitebuilderUwe Keim10-Oct-03 4:11 
GeneralRe: AdRotator Pin
John Kendrick18-Oct-03 11:36
memberJohn Kendrick18-Oct-03 11:36 
GeneralRe: AdRotator Pin
Per Søderlind18-Oct-03 16:46
sussPer Søderlind18-Oct-03 16:46 
GeneralRe: AdRotator Pin
John Kendrick19-Oct-03 12:05
memberJohn Kendrick19-Oct-03 12:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161128.1 | Last Updated 15 Oct 2003
Article Copyright 2003 by Per S
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid