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:
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> |
--------------------
|