PDA

View Full Version : word clock



Alcide
06-24-2013, 07:40 AM
Hi,

I have some code for a word clock, I am new in to Javascript, and Ill hope someone can help me out.

The word clock I have is made in Chinese, I mean the time is with Chinese Characters,

The Chinese time has 3 time frame's, like morning, noon and afternoon.

- from 6 till 12 its morning (06.00 ~ 12.00)
- from 12 untill 2 its noon (12.00 ~ 14.00)
- from 2 untill 6 its afternoon ( 14.00 ~ 06.00)

The clock I have is combine, CSS, JAVA and HTML..

The have Java script looks like this


//AM or PM
if (hours>=12) {
document.getElementById("timeframe2").style.color = "#F00";
AorP="P.M.";
hours -=12;
} else {
document.getElementById("timeframe1").style.color = "#F00";
AorP="A.M.";

}

The HTML looks like this, I changed already for 3 timeframes, but I don't know how to handle in the Javascript


<p><span><span id="timeframe1">上午</span>&nbsp;
<span id="timeframe2">中午</span> <span id="timeframe3">下午</span><br />

<br />
</span>

Can someone can help me.

Thx for reading and your time