Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JS] Zmniana obiektu co pół godziny a nie godzinę
suluben
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 7.06.2010

Ostrzeżenie: (0%)
-----


Mam taki prosty skrypt jak poniżej. I chciałbym aby zdania lub grafiki, zamiast co godzinę, zmieniały się co pół godziny, albo co 20 minut.
Z góry dziękuję za pomoc.

Kod
<script language="JavaScript">

<!--

day = new Date()

hr = day.getHours()

if (hr ==1)

document.write("Good morning! 1AM and still your going! ")

if (hr ==2)

document.write("Hey, it is past 2AM! The bars must be closed!")

if (hr ==3)

document.write("Hey, it is after 3AM! Are you a vampire or what?")

if (hr ==4)

document.write("4AM? You must roam all night huh!")

if (hr ==5)

document.write("Whoa! It's almost daylight and your still going!")

if (hr ==6)

document.write("Hey, isn't it too early to be using your computer")

if ((hr == 6) || (hr ==7) || (hr ==8) || (hr == 9) || (hr ==10))

document.write("Good Morning!")

if (hr ==11)

document.write("11AM...What are you doing surfing JavaScript pages so early??")

if (hr ==12)

document.write("NOON! Great, it must be time for me to eat breakfast!")

if (hr ==14)

document.write("It's 2PM. Have you eaten lunch yet??")

if ((hr==15) || (hr==16) || (hr==13))

document.write("Good Afternoon!")

if ((hr==17) || (hr==18) || (hr==19) || (hr==20) || (hr==21) || (hr==22))

document.write("Good Evening! Welcome to prime time on the web!")

if (hr==23)

document.write("It's almost midnight...Aren't you sleepy yet?")

if (hr==0)

document.write("It's midnight... do you ever sleep?")

document.write("</font></center>")

//--->

</script>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
Wicepsik
post
Post #2





Grupa: Zarejestrowani
Postów: 1 575
Pomógł: 299
Dołączył: 26.03.2009

Ostrzeżenie: (20%)
X----


http://www.w3schools.com/jsref/jsref_getminutes.asp
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 11:33