Script banner rotator

Întrebări / Probleme / Coduri / Tutoriale .etc
Post Reply
User avatar
tataieee
Administrator
Posts: 3832
Joined: 17 Sep 2014, 17:52
Nume Real: Alexandru Costin
Nivel cunoştinţe IT: 10
Location: Giurgiu; România
Contact:

19 Sep 2014, 19:26

Zilele astea am căutat un asemenea script deoarece aveam nevoie, în final am găsit ceva foarte bun :

Code: Select all

<script type="text/javascript">
var imgs3 = new Array(
	"http://siteul-tau/images/banners/banner1.jpg",
	"http://siteul-tau/images/banners/banner2.jpg",
	"http://siteul-tau/images/banners/banner3.jpg"
	);
var lnks3 = new Array(
	"http://siteul-1.ro",
	"http://siteul-1.ro",
	"http://siteul-1.ro"
	);
var alt3 = new Array(
	"Siteul 1",
	"Siteul 2",
	"Siteul 3"
	);
var currentAd3 = 0;
var imgCt3 = 3; // <<<=== Numarul de bannere afisate
function cycle3() {
  if (currentAd3 == imgCt3) {
    currentAd3 = 0;
  }
var banner3 = document.getElementById('adBanner3');
var link3 = document.getElementById('adLink3');
  banner3.src=imgs3[currentAd3]
  banner3.alt=alt3[currentAd3]
  document.getElementById('adLink3').href=lnks3[currentAd3]
  currentAd3++;
}
  window.setInterval("cycle3()",10000);
</script>
<a href="http://siteul-1.ro" id="adLink3" target="_top">
<img src="http://siteul-tau/images/banners/banner1.jpg" id="adBanner3" border="0" width="468" height="60"></a>
*Email: w.tataieee@gmail.com
*PayPal: w.tataieee@yahoo.com
Post Reply

Return to “HTML, HTML 5, Web Scripting, Index/Intro”