Buat file teks baru, salin kode berikut, dan ubah nama file menjadi clock.html dan jalankan.
<Bahasa skrip = javascript> <!- dcol = '0000ff'; // warna tanggal. fcol = '0000ff'; // warna wajah. scol = '0000ff'; // warna detik. MCOL = '0000ff'; // Minutes Color. HCOL = '0000ff'; // Warna Jam. Clockheight = 40; Clockwidth = 40; ClockFrommousey = 0; ClockFrommousEx = 100; // ubah tidak ada di bawah! Penyelarasan akan hilang! D = Array Baru ("Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"); M = Array Baru ("Januari", "Februari", "March", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"); tanggal = tanggal baru (); day = date.getDate (); tahun = date.getYear (); if (tahun <2000) tahun = tahun+1900; TodaySdate = ""+d [date.getday ()]+""+day+""+m [date.getMonth ()]+""+tahun; D = TodaysDate.Split (''); H = '...'; H = h.split (''); M = '....'; M = m.split (''); S = '.....'; S = s.split (''); Wajah = '1 2 3 4 5 6 7 8 9 10 11 12'; font = 'Arial'; ukuran = 1; Kecepatan = 0,5; ns = (document.layers); IE = (document.all); Wajah = face.split (''); n = face.length; a = ukuran*10; ymouse = 0; xmouse = 0; scrll = 0; props = "<font face ="+font+"size ="+size+"color ="+fcol+"> <b>"; props2 = "<font face ="+font+"size ="+size+"color ="+dcol+"> <b>"; Split = 360/n; Dsplit = 360/d.length; Handheight = clockheight/4.5 handwidth = clockwidth/4.5 handy = -7; Handx = -2.5; scrll = 0; Langkah = 0,06; Currstep = 0; y = array baru (); x = array baru (); y = array baru (); x = array baru (); untuk (i = 0; i <n; i ++) {y [i] = 0; x [i] = 0; y [i] = 0; x [i] = 0} dy = array baru (); dx = array baru (); dy = array baru (); dx = array baru (); untuk (i = 0; i <d.length; i ++) {dy [i] = 0; dx [i] = 0; dy [i] = 0; dx [i] = 0} if (ns) {for (i = 0; i <d.length; i ++) Dokumen. width = '+a+'> <senter> '+props2+d [i]+' </font> </center> </layer> '); untuk (i = 0; i <n; i ++) document.write ('<layer name = "nsface'+i+'" top = 0 left = 0 height ='+a+'width ='+a+'> <senter>'+face+face [i]+'</font> </center> </layer>'); untuk (i = 0; i <s.length; i ++) document.write ('<name layer = nsseconds'+i+'atas = 0 kiri = 0 lebar = 15 tinggi = 15> <font face = ukuran arial = 3 warna ='+scol+'> <use> <b>'+s [i]+'</b> </center> font> </center> <b>'+s [i]+'</b> </center> font> font> <b>'+s [i]+'</b> </center> font> font> font>'); untuk (i = 0; i <m.length; i ++) document.write ('<name layer = nsminutes'+i+'top = 0 kiri = 0 lebar = 15 tinggi = 15> <font face = ukuran arial = 3 warna ='+mcol+'> <use> <b>'+m [i]+'</b> </center> </font> <b>'+m [i]+'</b> </center> </font> <b>'+m [i]+'</b> </center> </font> <b>') </lay ') </i]; untuk (i = 0; i <h.length; i ++) Document.write ('<Lapisan Nama = NShours'+i+'Top = 0 Left = 0 Lebar = 15 Tinggi = 15> <Font Face = Ukuran Arial = 3 Warna ='+HCOL+'> <use> <b>'+h [i]+'</b> </font> </font> </center> font> <b>'+h [i]+'</b> </font> </font> FONT>; } if (yaitu) {document.write ('<div id = "od" style = "Posisi: absolute; atas: 0px; kiri: 0px"> <div style = "Posisi: relatif">'); untuk (i = 0; i <d.length; i ++) document.write ('<div id = "iedate" style = "Posisi: absolute; atas: 0px; kiri: 0; tinggi:'+a+'; lebar:'+a+'; Text-Align: center">+divs2+d [i]+' </b> </font> </font> </divs2+d [i]+'</b> </font> </font> </Divs2+d [i]+' </b> </font> </font> </Divs2+D [i]+'</b> </font> </font> </Divs2); document.write ('</div> </div>'); document.write ('<div id = "dari" style = "Posisi: absolute; atas: 0px; kiri: 0px"> <div style = "Posisi: relatif">'); untuk (i = 0; i <n; i ++) dokumen.write ('<div id = "ieface" style = "Posisi: absolute; atas: 0px; kiri: 0; tinggi:'+a+'; lebar:'+a+'; text-align: center">'+face+face [i]+'</b> </font> </div> document.write ('</div> </div>'); document.write ('</div> </div>'); document.write ('<div id = "oh" style = "posisi: absolute; atas: 0px; kiri: 0px"> <div style = "Posisi: relatif">'); untuk (i = 0; i <h.length; i ++) document.write ('<div id = "iehours" style = "Posisi: absolute; lebar: 16px; tinggi: 16px; font-family: arial; font-size: 16px; color:'+hcol+'; Text-gulai: center; font-weight-weight: bold-weight: bold-weight: bold-weight: hcol"+hcol+'; Text-ayign: center; font-weight-weight; document.write ('</div> </div>'); document.write ('<div id = "om" style = "posisi: absolute; atas: 0px; kiri: 0px"> <div style = "Posisi: relatif">'); untuk (i = 0; i <m.length; i ++) document.write ('<div id = "ieminutes" style = "Posisi: absolute; lebar: 16px; tinggi: 16px; font-family: arial; font-size: 16px; color:'+mcol+'; Text-align: center; font-weight: bold: bold: bold"/mcol+'; Text-align: center; font-weight: bold: bold: bold "moD’/mcol+'/mcol'; font: font-weight: bold: bold: bange '[moD'+'///</align: center; font-weight: bold: bold: bold "[m [moD’/mcol'; Text-align: center; font-weight: bold: bold: bold: bange "/mcol+’++’/mcol’; Document.write ('</div> </div>') document.write ('<div id = "os" style = "Posisi: absolute; atas: 0px; kiri: 0px"> <div style = "Posisi: relatif">'); for (i=0; i < S.length; i++) document.write('<div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold">'+S[i]+'</div>'); document.write ('</div> </div>')} (ns)? window.captureEvents (event.mouseMove): 0; fungsi mouse (evnt) {ymouse = (ns)? evnt.pagey+clockFrommousey- (window.pageyoffset): event.y+clockFrommousey; xmouse = (ns)? evnt.pagex+clockFrommousex: event.x+clockFrommousExx; } (ns)? window.onmouseMove = mouse: document.onmouseMove = mouse; function callandAssign () {time = new date (); sec = time.getSeconds (); sec = -1.57 + math.pi * dtk/30; mins = time.getMinutes (); min = -1.57 + Math.pi * menit/30; hr = time.getHours (); jam = -1.575 + math.pi * hr/6 + math.pi * parseInt (time.getMinutes ())/360; if (ie) {od.style.top = window.document.body.scrolltop; Of.style.top = window.document.body.scrolltop; Oh.style.top = window.document.body.scrolltop; Om.style.top = window.document.body.scrolltop; Os.style.top = window.document.body.scrolltop; } untuk (i = 0; i <n; i ++) {var f = (ns)? Document.layers ['nsface'+i]: ieface [i] .style; F.top = y [i] + clockHeight*math.sin (-1.0471 + i*split*math.pi/180) + scrll; F.left = x [i] + clockwidth*math.cos (-1.0471 + i*split*math.pi/180); } untuk (i = 0; i <h.length; i ++) {var hl = (ns)? Document.layers ['nshours'+i]: iehours [i] .style; Hl.top = y [i]+handy+(i*handheight)*math.sin (jam)+scrll; Hl.left = x [i]+handx+(i*handwidth)*math.cos (jam); } untuk (i = 0; i <m.length; i ++) {var ml = (ns)? document.layers ['nsminutes'+i]: ieminutes [i] .style; Ml.top = y [i]+handy+(i*handheight)*math.sin (min)+scrll; Ml.left = x [i]+handx+(i*handwidth)*math.cos (min); } untuk (i = 0; i <s.length; i ++) {var sl = (ns)? document.layers ['nsseconds'+i]: ieseconds [i] .style; Sl.top = y [i]+handy+(i*handheight)*math.sin (detik)+scrll; Sl.left = x [i]+handx+(i*handwidth)*math.cos (detik); } untuk (i = 0; i <d.length; i ++) {var dl = (ns)? Document.layers ['nsdate'+i]: iedate [i] .style; Dl.top = dy [i]+clockHeight*1.5*math.sin (Currstep+i*dsplit*math.pi/180)+scrll; Dl.left = dx [i] + clockwidth*1.5*math.cos (Currstep + i*dsplit*math.pi/180); } Currstep- = langkah; } function delay () {scrll = (ns)? window.pageyoffset: 0; Dy [0] = math.round (dy [0]+= ((ymouse) -dy [0])*kecepatan); Dx [0] = math.round (dx [0]+= ((xmouse) -dx [0])*kecepatan); untuk (i = 1; i <d.length; i ++) {dy [i] = math.round (dy [i]+= (dy [i-1] -dy [i])*kecepatan); Dx [i] = math.round (dx [i]+= (dx [i-1] -dx [i])*kecepatan); } y [0] = Math.round (y [0]+= ((ymouse) -y [0])*kecepatan); x [0] = Math.round (x [0]+= ((xmouse) -x [0])*kecepatan); untuk (i = 1; i <n; i ++) {y [i] = math.round (y [i]+= (y [i-1] -y [i])*kecepatan); x [i] = math.round (x [i]+= (x [i-1] -x [i])*kecepatan); } ClockandAssign (); setTimeout ('delay ()', 40); } if (ns || ie) window.onload = tunda; // -> </script>