Increase ad space with Rotating Banner ad script
January 9, 2011 Leave a comment
With minimal ad space! This could be the least thing you want right now and you wish you could add some more space. Got 5, 10 or more banner ads to display? Well there is a way to do it and its not just adding spaces, it display everything in the same place! And that’s what this post is about.
Credits to Verminox of Invisionfree.com for this script.
This code will change the image and link to another set after every page view or page impression. These are random banner ads that will displays any banner and link that is in the script.
To install, just copy-paste the code below then replace http://www.domain.com/page1.html
with your target url andhttp://www.domain.com/image1.gif with your target image
.
First Methode (basic)
This is the basic code that can contain 10 banners and 10 links. Width and height can be set via CSS styles.
/*
Rotating Ads per Page Load
by iFusion – http://forum.ifcode.com
*/
var ad = []
ad[0]=[“http://www.domain.com/page1.html” , “http://www.domain.com/image1.gif”%5D
ad[1]=[“http://www.domain.com/page2.html” , “http://www.domain.com/image2.gif”%5D
ad[2]=[“http://www.domain.com/page3.html” , “http://www.domain.com/image3.gif”%5D
ad[3]=[“http://www.domain.com/page4.html” , “http://www.domain.com/image4.gif”%5D
ad[4]=[“http://www.domain.com/page5.html” , “http://www.domain.com/image5.gif”%5D
ad[5]=[“http://www.domain.com/page6.html” , “http://www.domain.com/image6.gif”%5D
ad[6]=[“http://www.domain.com/page7.html” , “http://www.domain.com/image7.gif”%5D
ad[7]=[“http://www.domain.com/page8.html” , “http://www.domain.com/image8.gif”%5D
ad[8]=[“http://www.domain.com/page9.html” , “http://www.domain.com/image9.gif”%5D
ad[9]=[“http://www.domain.com/page10.html” , “http://www.domain.com/image10.gif”%5D
x = Math.floor(Math.random()*ad.length)
document.write(“<center>”)
document.write(“<a href='” + ad[x][0] + “‘>”)
document.write(“<img src='” + ad[x][1] + “‘ />”)
document.write(“</a>”)
document.write(“</center>”)
</script>
Define image size
Change the width and height values of the banner to whatever you prefer or your could use these popular ad banner sizes which are 468×60 (Horizontal), 250×250 (Square) and 300×250 (Horizontal) for better exposure.
/*
Rotating Ads per Page Load
by Verminox
*/
var ad = []
ad[0]=[“http://www.domain.com/page1.html” , “http://www.domain.com/image1.gif”%5D
ad[1]=[“http://www.domain.com/page2.html” , “http://www.domain.com/image2.gif”%5D
ad[2]=[“http://www.domain.com/page3.html” , “http://www.domain.com/image3.gif”%5D
ad[3]=[“http://www.domain.com/page4.html” , “http://www.domain.com/image4.gif”%5D
ad[4]=[“http://www.domain.com/page5.html” , “http://www.domain.com/image5.gif”%5D
ad[5]=[“http://www.domain.com/page6.html” , “http://www.domain.com/image6.gif”%5D
ad[6]=[“http://www.domain.com/page7.html” , “http://www.domain.com/image7.gif”%5D
ad[7]=[“http://www.domain.com/page8.html” , “http://www.domain.com/image8.gif”%5D
ad[8]=[“http://www.domain.com/page9.html” , “http://www.domain.com/image9.gif”%5D
ad[9]=[“http://www.domain.com/page10.html” , “http://www.domain.com/image10.gif”%5D
x = Math.floor(Math.random()*ad.length)
document.write(“<center>”)
document.write(“<table>”)
document.write(“<td id=’quote’>”)
document.write(“<a href='” + ad[x][0] + “‘>”)
document.write(“<img src='” + ad[x][1] + “‘ width=’300′ height=’100’ />”)
document.write(“</a>”)
document.write(“</td>”)
document.write(“</table>
“)
document.write(“</center>”)
</script>
If you have question and suggestion, please leave it below.