Ratator Bannerów
Prosty rataotor bannerów
Listing
SCRIPT LANGUAGE="javascript">
function banner(img_source,url,alt,chance) {
this.img_source = img_source;
this.url = url;
this.alt = alt;
this.chance = chance;
}
function display() {
with (this) document.write("<A HREF=" + url + "><IMG SRC='" + img_source + "' WIDTH=400 HEIGHT=50 BORDER=0 ALT='" + alt + "'></A>");
}
banner.prototype.display = display;
banners = new Array();
banners[0] = new banner("http://adres_strony1/banner.gif",
"http://www.sdres_strony1 target='_blank'",
"nazwa strony1",
2);
banners[1] = new banner("http://adres_strony2/banner.gif",
"http://www.adres_strony2 target='_blank'",
"nazwa strony2",
1);
banners[2] = new banner("http://adres_strony3/banner.gif",
"http://www.adres_strony3 target='_blank'",
"nazwa strony3",
3);
sum_of_all_chances = 0;
for (i = 0; i < banners.length; i++) {
sum_of_all_chances += banners[i].chance;
}
function display_banner() {
chance_limit = 0;
randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
for (i = 0; i < banners.length; i++) {
chance_limit += banners[i].chance;
if (randomly_selected_chance <= chance_limit) {
document.write("<A HREF=" + banners[i].url + "><IMG SRC='" + banners[i].img_source + "' WIDTH=400 HEIGHT=50 BORDER=0 ALT='" + banners[i].alt + "'></A>");
return banners[i];
break;
}
}
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="javascript">
<!--
top_banner = display_banner();
//-->
</SCRIPT>
function banner(img_source,url,alt,chance) {
this.img_source = img_source;
this.url = url;
this.alt = alt;
this.chance = chance;
}
function display() {
with (this) document.write("<A HREF=" + url + "><IMG SRC='" + img_source + "' WIDTH=400 HEIGHT=50 BORDER=0 ALT='" + alt + "'></A>");
}
banner.prototype.display = display;
banners = new Array();
banners[0] = new banner("http://adres_strony1/banner.gif",
"http://www.sdres_strony1 target='_blank'",
"nazwa strony1",
2);
banners[1] = new banner("http://adres_strony2/banner.gif",
"http://www.adres_strony2 target='_blank'",
"nazwa strony2",
1);
banners[2] = new banner("http://adres_strony3/banner.gif",
"http://www.adres_strony3 target='_blank'",
"nazwa strony3",
3);
sum_of_all_chances = 0;
for (i = 0; i < banners.length; i++) {
sum_of_all_chances += banners[i].chance;
}
function display_banner() {
chance_limit = 0;
randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
for (i = 0; i < banners.length; i++) {
chance_limit += banners[i].chance;
if (randomly_selected_chance <= chance_limit) {
document.write("<A HREF=" + banners[i].url + "><IMG SRC='" + banners[i].img_source + "' WIDTH=400 HEIGHT=50 BORDER=0 ALT='" + banners[i].alt + "'></A>");
return banners[i];
break;
}
}
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="javascript">
<!--
top_banner = display_banner();
//-->
</SCRIPT>
Dodano przez: qetli12 Ranga: 0 Punktów: 0
Komentarze użytkowników
:: Losowe artykuły
:: Wymiana linków
Modowe inspiracje |
Android Gry i Aplikacje |
ZaplanujTransport.pl: Przeprowadzki, transport, aukcje |
Logo dla firmy |
Change Tires - Car Weather Forecast Reminder |
Laminas: MVC Framework for PHP |
IT Books Reviews and Programming: JS, JAVA, PHP, ANDROID, CSS |
Katalog roślin |
Programming articles: JAVA, PHP, C++, Python, JavaScript |
Kancelaria Adwokacka Łukasz Huszno