Does anyone know such a script ? I searched but I din't find what I was looking for
And I don't want to complicate things with hosted files. I want to use this for advertisement on my site.
Thanks !
Does anyone know such a script ? I searched but I din't find what I was looking for
And I don't want to complicate things with hosted files. I want to use this for advertisement on my site.
Thanks !
http://www.dynamicdrive.com/dynamici...nslideshow.htm
http://www.dynamicdrive.com/dynamici...army/index.htm
Either of the two above slide show scripts can do linked images. And they can each also be set up in manual mode without controls or descriptions. And they each also have an optional random setting. So it's just a matter of which one you like. As I say, either can be set to show just one image w/link per page load.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Hi,
Thank you for your reply, the code is good, but is there another, one wich I can use directly html codes
Even javascript. Is there ?Code:<a href="" title=""><img src="" /></a>
Sorry for the bump but can anyone help me please ?
Hi,
I do not know of a script whereby you can have all the html on the page and it just chooses one of them to display, I use this one here: www.test.steptoes.co.uk to display different adverts on the left hand side.
Thats all you need in your body tags..
Thats all you need in the external file.. (js/banner.js)Code:<script type="text/javascript" src="js/banner.js"></script>
I think that is pretty easy to use. You can see the HTML the script will write out in the javascript.Code:<!-- function random_imglink(){ var myimages=new Array() //specify random images below. You can have as many as you wish myimages[1]="images/banner/1.jpg" myimages[2]="images/banner/2.jpg" myimages[3]="images/banner/3.jpg" myimages[4]="images/banner/4.jpg" myimages[5]="images/banner/5.jpg" myimages[6]="images/banner/6.jpg" //specify corresponding links below var imagelinks=new Array() imagelinks[1]="/link1.html" imagelinks[2]="/link2.html" imagelinks[3]="/link3.html" imagelinks[4]="/link4.html" imagelinks[5]="/link5.html" imagelinks[6]="/link6.html" var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>') } random_imglink() //-->
Hope that helps.
You could combine the two -
banner.js:
In the body section where you want the banner to appear:Code:function random_imglink(){ var myimages = [], ry, lnk; //specify random images below. You can have as many as you wish myimages[0] = "images/banner/1.jpg"; myimages[1] = "images/banner/2.jpg"; myimages[2] = "images/banner/3.jpg"; myimages[3] = "images/banner/4.jpg"; myimages[4] = "images/banner/5.jpg"; myimages[5] = "images/banner/6.jpg"; //specify corresponding links below var imagelinks = []; imagelinks[0] = "/link1.html"; imagelinks[1] = "/link2.html"; imagelinks[2] = "/link3.html"; imagelinks[3] = "/link4.html"; imagelinks[4] = "/link5.html"; imagelinks[5] = "/link6.html"; ry = Math.floor(Math.random() * myimages.length); lnk = document.getElementById('bannerlink'); lnk.href = imagelinks[ry]; lnk.getElementsByTagName('img')[0].src = myimages[ry]; } random_imglink();
Code:<a id="bannerlink" href="/link1.html" title=""><img src="images/banner/1.jpg" alt="" /></a> <script type="text/javascript" src="js/banner.js"></script>
Last edited by jscheuer1; 09-02-2010 at 02:44 PM. Reason: simplify
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Thank you !
Bookmarks