![]() |
![]() |
![]() ![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 73 Pomógł: 0 Dołączył: 17.02.2008 Skąd: Toruń Ostrzeżenie: (0%) ![]() ![]() |
Jak można zrobić na blogu wordpress, żeby wyświetlały się losowa 2 banery? znacie jakiś odpowiedni kod php lub java do tego?
Na przykład: [kod php lub java] kod banera 1 [kod php lub java] kod banera 2 [kod php lub java] i żeby losowo były wyświetlane 2 banery Czekam na pomoc, oczywiście będzie + |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 302 Pomógł: 18 Dołączył: 10.03.2008 Skąd: Dębno Ostrzeżenie: (0%) ![]() ![]() |
Google, Google i jeszcze raz Google. Pod frazą 'Rotator bannerów' jest pełno rozwiązań (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) Wystarczy trochę chęci (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Kod <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> Ten post edytował K4mil94 29.03.2009, 08:14:34 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 11.10.2025 - 09:08 |