»
EnglishFrenchVietnamese

Print - Random Ads - JavaScriptBank.com

Full version: jsB@nk » Image » Random Ads
URL: https://www.javascriptbank.com/random-ads.html

Random Ads © JavaScriptBank.comWhen the page is loaded, a random ad and JavaScript link are generated.

Full version: jsB@nk » Image » Random Ads
URL: https://www.javascriptbank.com/random-ads.html



JavaScript
<script language="javascript"><!--function randadd0(){//create an array of add images var i = new Array(new Image(120,60), new Image(120,60), new Image(120,60)); i[0].src="logojs.gif"; i[1].src="photo1.jpg"; i[2].src="photo3.jpg"; // I use constants so it will be easy to change values if I put up new adds  var INTELLIMOUSE="http://jsbank.topcities.com"; var SIMCITY="http://jsbank.topcities.com"; var QUICKEN="script589128_0_2.html#c"; //get a random number between 0 and the number of adds available  var pictnum=Math.round(Math.random()*3)-1; while(pictnum<0 || pictnum>3) pictnum=Math.round(Math.random()*3)-1; //change the banner add picture document.link0.src=i[pictnum].src; //change the banner add link to match the picture  if(pictnum==0)  document.links[0].href=INTELLIMOUSE; else if(pictnum==1)  document.links[0].href=SIMCITY; else if(pictnum==2)  document.links[0].href=QUICKEN;}//--></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onLoad="randadd0()"><a href="http://javascriptbank.com"><IMG SRC="logojs.gif" BORDER=0 NAME="link0" ALT="add banner"></a></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->