Cara memasang/menampilkan jam digital menggunakan javascript.
Setelah beberapa hari yang lalu post artikel memasang jam analog sekarang gilirannya
memasang jam digital.
Jam nya sama-sama keren, sama-sama oke dan sama-sama mantab.. tab.. taaaab..
Silahkan dilihat demonya:
Caranya, pasang kode dibawah ini dibagian <head> di blog/website kamu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<style type="text/css">
#jam {
 font-size: 24px;
 color: #7AB3FD;
 font-weight: none;
 font-style: none;
 font-family: impact;
 font-smooth: always;
 border: 0px;
 filter:alpha(opacity=70);
 -moz-opacity:0.7;
 -khtml-opacity: 0.7;
 opacity: 0.7;
 -moz-border-radius: 5px; /* this works only in camino/firefox */
 -webkit-border-radius: 5px; /* this is just for Safari */
 position:fixed;_position:absolute;bottom:0px; right:0px;
 clip:inherit;
 _top:expression(document.documentElement.scrollTop+ document.documentElement.clientHeight-offsetHeight);
 _left:expression(document.documentElement.scrollLeft+ document.documentElement.clientWidth-offsetWidth);
}
</style>

Kemudian pasang kode dibawah ini setelah baris <body>
Salin kode JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<body onload="startclock ();">
<script language="JavaScript">
 
<!-- Hide from non Java browsers
var timerID = null;
var timerRunning = false;
var id,pause=0,position=0;
 
function stopclock (){
        if(timerRunning)
               clearTimeout(timerID);
        timerRunning = false;
}
function showtime () {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()
        var timeValue = "" + ((hours >12) ? hours -12 :hours)
        timeValue += (hours >= 12) ? " pm" : " am"
        timeValue += ((minutes < 10) ? " 0" : " ") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds
        document.clock.face.value = timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}
 
function startclock () {
        stopclock();
        showtime();
}
// -->
</script>
<form name="clock" onsubmit="0">
    <div id="jam" name="face"><input id="jam" type="text" size="10"
    name="face"></div>
</form>

Selamat mencoba…!!!