This skin was created by Lightz of the IF Skin Zone.
Hunt's Writer and Reader Forum

We've Moved To RKPHunt.com/forum.

You can no longer reply or post to these threads, but feel free to browse through them.

 

 Rotating/random Banners
RHunt
Posted: Jun 25 2005, 03:11 AM


Administrator
Group Icon

Group: Admin
Posts: 724
Member No.: 1
Joined: 16-June 04



Had one or two people ask me about the rotating banner exchange code that I have on RKP Hunt's Literary Works and Litworks Main Page. So, here it is and my second post will be the random banner, which shows a random banner whenever you refresh the website. I got this code at Dynamic Drive.

This part of the script goes into the <head></head> of your website. Btw, most forums don't allow you to show your own advertising ie banner exchanges.

Rotating Script:

QUOTE
<!-- This script and many more are available free online at -->

<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Original:  Team DynamicDrive -->

<!-- Web Site:  http://www.dynamicdrive.com -->

<style type="text/css">



.gallerycontroller{

width: 150px;

height: 35px;


}



.gallerycontent{

width: 468px;

height: 75px;

border: 0px solid black;

background-color: #;

padding: 3px;

display: block;

}



</style>



<script type="text/javascript">



/***********************************************

* Advanced Gallery script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)

* This notice must stay intact for legal use

* Visit http://www.dynamicdrive.com/ for full source code

***********************************************/



var tickspeed=10000 //ticker speed in miliseconds (2000=2 seconds)

var displaymode="auto" //displaymode ("auto" or "manual"). No need to modify as form at the bottom will control it, unless you wish to remove form.



if (document.getElementById){

document.write('<style type="text/css">\n')

document.write('.gallerycontent{display:none;}\n')

document.write('</style>\n')

}



var selectedDiv=0

var totalDivs=0



function getElementbyClass(classname){

partscollect=new Array()

var inc=0

var alltags=document.all? document.all.tags("DIV") : document.getElementsByTagName("*")

for (i=0; i<alltags.length; i++){

if (alltags[i].className==classname)

partscollect[inc++]=alltags[i]

}

}



function contractall(){

var inc=0

while (partscollect[inc]){

partscollect[inc].style.display="none"

inc++

}

}



function expandone(){

var selectedDivObj=partscollect[selectedDiv]

contractall()

selectedDivObj.style.display="block"

temp.options[selectedDiv].selected=true

selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0

if (displaymode=="auto")

autocontrolvar=setTimeout("expandone()",tickspeed)

}



function populatemenu(){

temp=document.gallerycontrol.menu

for (m=temp.options.length-1;m>0;m--)

temp.options[m]=null

for (i=0;i<totalDivs;i++){

var thesubject=partscollect[i].getAttribute("subject")

thesubject=(thesubject=="" || thesubject==null)? "HTML Content "+(i+1) : thesubject

temp.options[i]=new Option(thesubject,"")

}

temp.options[0].selected=true

}



function manualcontrol(menuobj){

if (displaymode=="manual"){

selectedDiv=menuobj

expandone()

}

}



function preparemode(themode){

displaymode=themode

if (typeof autocontrolvar!="undefined")

clearTimeout(autocontrolvar)

if (themode=="auto"){

document.gallerycontrol.menu.disabled=true

autocontrolvar=setTimeout("expandone()",tickspeed)

}

else

document.gallerycontrol.menu.disabled=false

}





function startgallery(){

document.getElementById("controldiv").style.display="block"

getElementbyClass("gallerycontent")

totalDivs=partscollect.length

populatemenu()

for (i=0; i<document.gallerycontrol.mode.length; i++){

if (document.gallerycontrol.mode[i].checked)

displaymode=document.gallerycontrol.mode[i].value

}

if (displaymode=="auto")

document.gallerycontrol.menu.disabled=true

expandone()

}



if (window.addEventListener)

window.addEventListener("load", startgallery, false)

else if (window.attachEvent)

window.attachEvent("onload", startgallery)

else if (document.getElementById)

window.onload=startgallery



</script>


This is the code you put where you want the changes to show up. In the <body></body>

QUOTE
<!-- This script and many more are available free online at http://www.ibold.net-->


<!-- Original:  Team DynamicDrive -->

<!-- Web Site:  http://www.dynamicdrive.com -->

<div class="gallerycontent" subject="Literary Works Forum">


<!-- Litworks Code begin -->
<CENTER>
<a href="http://s8.invisionfree.com/hunts_forum"><img src="logo5.gif" border="0" alt="Join The Chat !"></a>
</CENTER>
<center>
<a href="http://s8.invisionfree.com/hunts_forum" target="_blank"><font face="verdana" size="1">Post Your Works and Comment On Others</font></a>
</center>
<!-- Litworks Code end -->
</div>

<center>
<div class="gallerycontent" subject="Ahadada Banner Exchange">
<!--Begin Ahadada Banner Exchange code -->
<center><iframe align=top width=468 height=60 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no src="http://www.sendecki.com/ahadada/exchange/view.php?uid=10&cat=0"><ilayer align=top width=468 height=60 src="http://www.sendecki.com/ahadada/exchange/view.php?uid=10&cat=0"></ILAYER> </iframe><br><a href="http://www.sendecki.com/ahadada/exchange/index.php?ref=10"><font face=Arial size=1>Advertise with us!</a></font></center>
<!--End Ahadada Banner Exchange code -->
</div>



</div></center>


The parts in bold are two banners one might use. You can chance the words after subject=" to the banner exchange name. This is a must, because it displays this name in the control panel. You always start the banner with:

QUOTE
<div class="gallerycontent" subject="Ahadada Banner Exchange">


And then end it with:

QUOTE
</div>


Your banner code goes in between. Works easy with banner exchange codes, and you'll want to take a better look at the litworks code (first one) to see how you can use your own banners.

This is the banner control to allow your visitors to stop the rotation and go through it manually. I don't know if this code works without it. This goes in the <body</body> as well. You can put it directly underneath the banner code or somewhere else on the website.

QUOTE
<div id="controldiv" style="display:none" class="gallerycontroller">
<CENTER>
<form name="gallerycontrol">

        <select class="gallerycontroller" size="3" name="menu" onChange="manualcontrol(this.options.selectedIndex)">

        <option>Blank form</option>

        </select><br><font size="1">
<font color="000000">Auto: <input type="radio" checked name="mode" value="auto" onClick="preparemode('auto')"><font color="000000"> Manual: <input type="radio" name="mode" value="manual" onClick="preparemode('manual')"></font>
</center>


--------------------
"The best way to have a good idea is to have lots of ideas." - Linus Pauling
My Webpage - RKP Hunt's Literary Works
Top
RHunt
Posted: Jun 25 2005, 03:25 AM


Administrator
Group Icon

Group: Admin
Posts: 724
Member No.: 1
Joined: 16-June 04



Random Banner

Here is the random banner code. You can find it here at the orginal page: http://simplythebest.net/scripts/DHTML_scr...ascript_21.html I never tried to fit this one to a banner exchange, but it works well with topsites. You can use them on forums as long as they are for topsites.

This is the that goes into the <head></head> of the website.

QUOTE
<SCRIPT LANGUAGE="javascript">
<!-- Copyright 2000 - Galichon Enterprises, Inc.  rich@galichon.net  http://www.galichon.net
// Permission granted to SimplytheBest.net to list the script in the DHTML scripts library
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
function banner(img_source,url,alt,chance) {
   this.img_source = img_source;
   this.url = url;
   this.alt = alt;
   this.chance = chance;
}
function display() {
   with (this) document.write("<A HREF=" + url + "><IMG SRC='" + img_source + "' WIDTH=88 HEIGHT=31 BORDER=0 ALT='" + alt + "'></A>");
}
banner.prototype.display = display;
banners = new Array();

banners[0] = new banner("http://img2.exs.cx/img2/3343/topsiteBAMM.gif",
                        "http://topsites.bvdesigns.net/in.php?uid=3499&id=rkphunt/ target='new window'",
                        "Vote At Bamm Topsite",
                        10);

banners[1] = new banner("rom100.jpg",
                        "http://www.romancetop100.com/sites/in.php?id=rhunt'",
                        "Vote for Me",
                        10);

banners[2] = new banner("http://www.litscene.com/images/litscene-button.gif",
                        "http://litscene.com/Detailed/2993.php'",
                        "Vote for Me",
                        10);


sum_of_all_chances = 0;
for (i = 0; i < banners.length; i++) {
   sum_of_all_chances += banners[i].chance;
}
function display_banner() {
   chance_limit = 0;
   randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
   for (i = 0; i < banners.length; i++) {
      chance_limit += banners[i].chance;
      if (randomly_selected_chance <= chance_limit) {
         document.write("<A HREF=" + banners[i].url + "><IMG SRC='" + banners[i].img_source + "' WIDTH=88 HEIGHT=31 BORDER=0 ALT='" + banners[i].alt + "'></A>");
         return banners[i];
         break;
      }
   }
}
//-->
</SCRIPT>


Make sure you change the above highlighted to the proper proportions of the banners you are using.

You can see the banners are clearly marked banners[0] which needs to be changed for each banner. Also the number 10 at the bottom of the script if a frequency number. That tells the code how often you want that banner to be seen. So if you put 20 for one banner and 10 for the other, the first will be seen more often. Just put all 10's or any number for that matter in tens if you want them to appear equally.

QUOTE
banners[0] = new banner("http://img2.exs.cx/img2/3343/topsiteBAMM.gif",
                        "http://topsites.bvdesigns.net/in.php?uid=3499&id=rkphunt/ target='new window'",
                        "Vote At Bamm Topsite",
                        10);



This script goes in your <body></body> You can use it as much as you want and several different banners will appear. Put a <BR> at the end, if you want them to take atop of eachother. Or just post them right next to eachother to get a line. If you have any questions go ahead and ask.


QUOTE

<SCRIPT LANGUAGE="javascript">
<!--
top_banner = display_banner();
//-->
</SCRIPT>


--------------------
"The best way to have a good idea is to have lots of ideas." - Linus Pauling
My Webpage - RKP Hunt's Literary Works
Top

Topic Options


Affiliates
Jude Place MSN Group Arcane Alcazar Fiction Co. The Writer's Forum Angie's World - Great General Forum Black Rose Manor URL.biz - where people find experts


Links
Writer's Sites:

RHunt's Site

WriteFree's Site

Atrius' Site

Bsolah's Site

Useful Sites for Writers:

HED Forum

Websites To Post Your Work

Free Ebook Directory

The Mannerly Art of Critique

Making Your Free Site Popular


HED 
Topsite

Erudite Enumeration

Poll
What do you look for when joining a forum?
View Results
Powered by Pliner.Net Polls
Link To Us


More Banners Here
Literary Works Forum is a FREE service for writers, poets, and more. All Rights Reserved. Copyrighted 2004-2007
All Trademarks and Copyrights belong to the respective owner herein. Permission to reproduce must be obtained from the respective owners.

Hosted for free by InvisionFree (Terms of Use: Updated 7/7/05) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Archive