قم بإنشاء ملف نصي جديد ، ونسخ الكود التالي ، وقم بتغيير اسم الملف إلى clock.html وقم بتشغيله.
<لغة البرنامج النصي = javaScript> <!- dcol = '0000ff' ؛ // color date. fcol = '0000ff' ؛ // لون الوجه. SCOL = '0000FF' ؛ // Seconds Color. MCOL = '0000FF' ؛ // minor color. HCOL = '0000FF' ؛ // ساعات اللون. clockheight = 40 ؛ عرض الساعة = 40 ؛ clockfrommousey = 0 ؛ clockfrommousex = 100 ؛ // تغيير لا شيء أدناه! سوف تضيع المحاذاة! D = New Array ("Sunday" ، "Monday" ، "Tuesday" ، "Wednesday" ، "Finay" ، "Friday" ، "Saturday") ؛ M = New Array ("January" ، "February" ، "March" ، "April" ، "May" ، "June" ، "July" ، "August" ، "September" ، "October" ، "November" ، "December") ؛ التاريخ = تاريخ جديد () ؛ اليوم = date.getDate () ؛ السنة = date.getyear () ؛ إذا (السنة <2000) السنة = سنة+1900 ؛ TodaySdate = ""+d [date.getDay ()]+""+day+""+m [date.getMonth ()]+""+year ؛ d = todaysdate.split ('') ؛ H = '...' ؛ h = h.split ('') ؛ M = '....' ؛ M = M.Split ('') ؛ s = '.....' ؛ s = s.split ('') ؛ الوجه = '1 2 3 4 5 6 7 8 9 10 11 12' ؛ font = 'arial' ؛ الحجم = 1 ؛ السرعة = 0.5 ؛ ns = (document.layers) ؛ ie = (document.all) ؛ Face = face.split ('') ؛ n = face.length ؛ A = الحجم*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>" ؛ انقسام = 360/n ؛ dsplit = 360/d.length ؛ handheight = clockheight/4.5 handwidth = clockwidth/4.5 Handy = -7 ؛ handx = -2.5 ؛ scrll = 0 ؛ الخطوة = 0.06 ؛ curstep = 0 ؛ y = new array () ؛ x = new array () ؛ y = new array () ؛ x = new array () ؛ لـ (i = 0 ؛ i <n ؛ i ++) {y [i] = 0 ؛ x [i] = 0 ؛ y [i] = 0 ؛ x [i] = 0} dy = new array () ؛ dx = new array () ؛ dy = new array () ؛ dx = new array () ؛ لـ (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 ++) document.write ('<layer name = "nsdate'+i+' width = '+a+'> <centre> '+props2+d [i]+' </font> </center> </leder> ') ؛ لـ (i = 0 ؛ i <n ؛ i ++) document.write ('<layer name = "nsface'+i+'" top = 0 left = 0 height ='+a+'width ='+a+'> <centre>'+props+face [i]+'</font> </center> </layer>) ؛ لـ (i = 0 ؛ i <s.length ؛ i ++) document.write ('<layer name = nsseconds'+i+'top = 0 left = 0 width = 15 height = 15> <font face = arial size = 3 color =' scol+'> <b>'+s [i]+'</b> </center> لـ (i = 0 ؛ i <m.length ؛ i ++) document.write ('<layer name = nsminutes'+i+'top = 0 left = 0 width = 15 height = 15> <font face = arial size = 3 color ='+mcol+'> <b>'+m [i]+'</b> </center> لـ (i = 0 ؛ i <h.length ؛ i ++) document.write ('<layer name = nshours'+i+'top = 0 left = 0 width = 15 height = 15> <font face = arial size = 3 color ='+hcol+'> <b>'+h [i]+'</b> </font> } if (ie) {document.write ('<div id = "od" style = "الموضع: absolute ؛ top: 0px ؛ left: 0px"> <div style = "الموضع: النسبية">') ؛ لـ (i = 0 ؛ i <d.length ؛ i ++) document.write ('<div id = "iedate" style = "الموقف: top: 0px ؛ اليسار: 0 ؛ الارتفاع:'+a+'؛ width:'+a+' document.write ('</div> </viv>') ؛ document.write ('<div id = "من" style = "الموضع: absolute ؛ top: 0px ؛ اليسار: 0px"> <div style = "الموضع: النسبية">') ؛ لـ (i = 0 ؛ i <n ؛ i ++) document.write ('<div id = "ieface" style = "الموضع: top: 0px ؛ اليسار: 0 ؛ الارتفاع:'+a+'؛ width:'+a+' document.write ('</div> </viv>') ؛ document.write ('</div> </viv>') ؛ document.write ('<div id = "oh" style = "الموضع: absolute ؛ top: 0px ؛ اليسار: 0px"> <div style = "الموضع: النسبية">') ؛ لـ (i = 0 ؛ i <h.length ؛ i ++) document.write ('<div id = "iehours" style = "الموقف: المطلق ؛ العرض: 16px ؛ الارتفاع: 16px ؛ font-family: arial ؛ font-size: 16px ؛ color:'+hcol+'؛ text-align: center ؛ document.write ('</div> </viv>') ؛ document.write ('<div id = "om" style = "الموضع: absolute ؛ top: 0px ؛ اليسار: 0px"> <div style = "الموضع: النسبية">') ؛ لـ (i = 0 ؛ i <m.length ؛ i ++) document.write ('<div id = "ieminutes" style = "الموضع: المطلق ؛ العرض: 16px ؛ الارتفاع: 16px ؛ font-family: arial ؛ font-size: 16px ؛ color:'+mcol+'؛ text-aliN: center ؛ document.write ('</div> </viv>') document.write ('<div id = "os" style = "position: absolute ؛ top: 0px ؛ left: 0px"> <div style = "position: relative">') ؛ لـ (i = 0 ؛ i <s.length ؛ i ++) document.write ('<div id = "ieseconds" style = "الموضع: المطلق ؛ العرض: 16px ؛ الارتفاع: 16px ؛ font-family: arial ؛ font-size: 16px ؛ color:'+scol+'؛ text-align: center ؛ font-weight: bold: document.write ('</div> </viv>')} (ns)؟ window.captureevents (event.mousemove): 0 ؛ وظيفة الماوس (evnt) {ymouse = (ns)؟ evnt.pagey+clockfrommousey- (window.pageyoffset): event.y+clockfrommousey ؛ Xmouse = (ns)؟ evnt.pagex+clockfrommousex: event.x+clockfrommousex ؛ } (ns)؟ window.onmousemove = الماوس: document.onmousemove = الماوس ؛ وظيفة clockandassign () {time = new date () ؛ sec = time.getSeconds () ؛ sec = -1.57 + math.pi * sec/30 ؛ mins = time.getMinutes () ؛ min = -1.57 + math.pi * mins/30 ؛ hr = time.gethours () ؛ HRS = -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 ؛ } لـ (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) ؛ } لـ (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 (hrs)+scrll ؛ hl.left = x [i]+handx+(i*handwidth)*math.cos (hrs) ؛ } لـ (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) ؛ } لـ (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 (sec)+scrll ؛ sl.Left = x [i]+handx+(i*handwidth)*math.cos (sec) ؛ } لـ (i = 0 ؛ i <d.length ؛ i ++) {var dl = (ns)؟ document.layers ['nsdate'+i]: eedate [i] .style ؛ dl.top = dy [i]+clockheight*1.5*math.sin (curstep+i*dsplit*math.pi/180)+scrll ؛ dl.left = dx [i] + clockwidth*1.5*math.cos (curstep + i*dsplit*math.pi/180) ؛ } curstep- = الخطوة ؛ } تأخير الوظيفة () {scrll = (ns)؟ window.pageyoffset: 0 ؛ dy [0] = Math.Round (dy [0]+= (ymouse) -dy [0])*السرعة) ؛ dx [0] = Math.Round (dx [0]+= ((xmouse) -dx [0])*السرعة) ؛ لـ (i = 1 ؛ i <d.length ؛ i ++) {dy [i] = Math.Round (dy [i]+= (dy [i-1] -dy [i])*السرعة) ؛ dx [i] = math.round (dx [i]+= (dx [i-1] -dx [i])*السرعة) ؛ } y [0] = Math.Round (y [0]+= (ymouse) -y [0])*السرعة) ؛ x [0] = Math.Round (x [0]+= ((xmouse) -x [0])*السرعة) ؛ لـ (i = 1 ؛ i <n ؛ i ++) {y [i] = math.round (y [i]+= (y [i-1] -y [i])*السرعة) ؛ x [i] = Math.Round (x [i]+= (x [i-1] -x [i])*السرعة) ؛ } clockandassign () ؛ setTimeout ('Delay ()' ، 40) ؛ } if (ns || ie) window.onload = delay ؛ // -> </script>