Pomoc oko ove skripte "ON AIR"
Pozdrav!
Potrebna mi je pomoc oko ove skripte, koja prikazuje sta se trenutno pusta na radio stanici, DJ, itd...meni je potrebno nesto slicno, ali kada iskopiram skriptu u zeljeni div, taj div i dalje ne prikazuje sadrzaj i nece uporno da proradi...moze li neka pomoc? Skripta je sledeca: <body onload = "display()"> <div id = "dj" > <script type = "text/javascript"> function display() { var show = "No show scheduled at present"; var GMToffset = -5; // Your current GMT offset, whether Standard or Daylight var now = new Date(); var dy = now.getDay(); // day of week 0-6 now.setHours(GMToffset + now.getHours() + now.getTimezoneOffset() / 60); var hh = now.getHours(); var mn = now.getMinutes(); hh = hh + (mn/60); // minutes expressed as fractions of an hour // The GMT offset ensures that every visitor, regardless of their timezone, will see the schedule // that is appropriate for the site owner's local time. // Tip - for testing purposes you can put here //dy = 5; //hh = 9.25; // or whatever to check that the right show appears at that day/time. if (dy >=1 && dy <=5) { // days in Javascript are 0 Sunday - 6 Saturday if (hh >=5 && hh <9) {show = "The Tom Joyner Morning Show"; document.getElementById("theImage").src = "Four.gif"} if (hh >=9 && hh <14) {show = "Carl T"; document.getElementById("theImage").src = "Two.gif"} } if (dy >=1 && dy <=5) { if (hh >=14 && hh <=18) {show ="Tommy C"} } if (dy >= 1 && dy <=4) { if (hh >=18 && hh <23) {show = "Keith Sweat"} } if (dy == 5) { if (hh >=18 && hh <=23) {show = "G.L.Haywood (House Party)"} //goes on to midnight } if (dy == 6) { // Saturday Note the two = signs to mean equals if (hh >= 6 && hh <9) {show = "The Tom Joyner Morning Show: Right Back At Cha!" } if (hh >= 9 && hh <14) {show = "Carl T"} if (hh >=14 && hh <20) {show = "George Fisher"} if (hh >=20 && hh <22) {show = "Chief Chris Omigee & Momanite Nurse"} if (hh >=22 && hh <24) {show = "House Party"} } //End of Saturday Shows if (dy == 0) { //Sunday Shows if (hh >= 5 && hh <10) {show = "Porshe Evans (Gospel)"} if (hh >=10 && hh <12) {show = "The Cravins Brothers Zydeco and Info Show with Charles & Donald Cravins"} if (hh >=12 && hh <17) {show = "George Fisher"} if (hh >=17 && hh <21) {show = "Dr. Boogie Live"} } // End of Sunday Shows var a = "On air now:- " + show + " \u00A0 \u00A0 \u00A0 \u00A0 "; // spaces must be separted by Unicode spaces to prevent collapse document.getElementById("dj").innerHTML = a; setTimeout("display()", 60000); // update every 60 seconds } </script> </div> |
Potrebana ti je i slika (img html element) koja će imati id theImage document.getElementById("theImage").src
JavaScript kod stavi unutar head dela stranice. |
Da, sad sam video gde je problem. A da li moze ispisati ovakav tekst recimo:
The Cravins Brothers Zydeco and Info Show with Charles ili bas mora striktno slika u ovom slucaju...? Pozdrav! |
Nisam siguran da li sam razumeo pitanje.
Iz koda se vidi za ovaj slučaj neće biti potrebna slika Kôd:
if (hh >=10 && hh <12) {show = "The Cravins Brothers Zydeco and Info Show with Charles & Donald Cravins"} U ovom primeru je slika potrebna ukoliko neko pristupa od Ponedeljaka do Petka u periodu od 5 do 9 i 9 -14. Kôd:
f (hh >=5 && hh <9) {show = "The Tom Joyner Morning Show"; document.getElementById("theImage").src = "Four.gif"} |
Hvala puno prijatelju! :)
Celo vreme sam pogresio to sto sam za div stavio class, umesto id. :) Sada radi ko sat! Sve najbolje! |
Treba mi jos dopuna cele ove price.
Javlja mi se problem kada zelim malo preciznije odrediti vreme (recimo u 12h 15 min), ali ne znam kako da ubacim i minute u celu pricu. Vidim da su definisani. Sta dalje? Pr. if (dy == 0) { //Sunday Shows if (hh >= 5 (ovde bih ubacio minute recimo) && hh <10 (i ovde)) {show = "Porshe Evans (Gospel)"} Pozdrav! |
Citat:
|
Aha, razumem sta si time hteo reci...mada znas, nekako mi je tesko proracunavati svaku satnicu na ovakav nacin, tj. nekako mi je nepristupacno, razumes...
da li mozda postoji neko resenje da mogu za 12h 15 min, uneti samo 12.15? Hvala ti puno na dosadasnjoj pomoci, i za ovo pitanje, i za ostala pitanja koje si mi pomogao! Sve najbolje! |
Pokušaj da umesto koda:
Kôd:
hh = hh + (mn/60); Kôd:
hh = parseFloat(hh + '.' + mn); |
Branko, treba mi tvoja pomoc u vezi ove skripte.
Imam problem da cim naredjam vise emisija u jednom danu, skripta prekine da ispisuje bilo sta. Primer: if (dy == 3 ) { if (hh >=05.00 && hh <06.00) {show ="EMISIJA 1" } if (hh >=06.00 && hh <07.20) {show ="EMSIJA 2" } if (hh >=07.20 && hh <08.25) {show ="EMISIJA 3" } if (hh >=08.25 && hh <9.00) {show ="EMISIJA 4" } if (hh >=9.00 && hh <10.00) {show ="EMISIJA 5" } } Cim stavim samo jednu ili dve stavke sve radi normalno...u cemu je problem? Moze li neka pomoc? Pozz |
Vreme je GMT +2. Trenutno vreme je 17:26. |
Powered by vBulletin® Verzija 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © DevProTalk. All Rights Reserved.