Selasa, 16 Agustus 2011

Membuat Jam Script 12/24 Jam

Cara Membuat Jam (clock) dengan menggunakan Script html dengan format 12 atau 24 hour
tinggal di Copy paste di web / blog anda.....

 
 

24 Hour Time
12 Hour Time

 
 
Click to start the script.

Put this code into your page:

<html>
<head>
<style>
.text
{
FONT: 10pt arial;
COLOR: black
}
</style>
<SCRIPT LANGUAGE="JavaScript">
function show24HourTime() {
if (document.clock.show24Hour[0].checked) {
return true;
}
return false;
}
function showTheHours(theHour) {
if (show24HourTime() || (theHour > 0 && theHour < 13)) {
if (theHour == "0") theHour = 12;
return (theHour);
}
if (theHour == 0) {
return (12);
}
return (theHour-12);
}
function showZeroFilled(inValue) {
if (inValue > 9) {
return "" + inValue;
}
return "0" + inValue;
}
function showAmPm() {
if (show24HourTime()) {
return ("");
}
if (now.getHours() < 12) {
return (" am");
}
return (" pm");
}
function showTheTime() {
now = new Date
document.clock.showTime.value = showTheHours(now.getHours()) + ":" + showZeroFilled(now.getMinutes()) + ":" + showZeroFilled(now.getSeconds()) + showAmPm()
setTimeout("showTheTime()",1000)
}
</script>
</head>
<BODY onLoad="showTheTime()">
<br><br><br>
<center><form name=clock>
<TABLE width="150" border="0" cellpadding="0" cellspacing="0" bgcolor=#F5F4E0>
<tr>
<td colspan=3><img src=images/spacer.gif height=10></td>
</tr>
<tr>
<td><img src=images/spacer.gif width=10></td>
<td bgcolor=white align=center><br><input type=text name=showTime size=11><p>
<input type=radio name=show24Hour checked><font class=text>24 Hour Time</font><br>
<input type=radio name=show24Hour><font class=text>12 Hour Time</font><br><br></td>
<td><img src=images/spacer.gif width=10></td>
</tr>
<tr>
<td colspan=3><img src=images/spacer.gif height=10></td>
</tr>
</table>
</form>
</center>
</body>
</html>

0 komentar:

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More