Русский
<!--要完成此效果把如下代码加入到<body>区域中--> <script> function syeClock() { if (!document.layers && !document.all) return; timePortion = новый массив; maxLength = новый массив; вар runTime = новая дата (); timePortion[0] = runTime.getHours(); timePortion[1] = runTime.getMinutes(); timePortion[2] = runTime.getSeconds(); МаксДлина[0] = 5; МаксДлина[1] = 6; МаксДлина[2] = 6; вар decValue = 0; вар decMod = 0; вар темп = ""; вар часыBackground = "#7B7BB5"; вар минутBackground = "#4D5487"; вар секундыBackground = "#424A63"; вар ColonBackground = "#000000"; var textColor = "#FFFFFF"; for (var curPor = 0; curPor <= 2; curPor++) { decValue = timePortion[curPor]; timePortion[curPor] = ""; while (decValue!= 0) { decMod = decValue% 2; decValue = Math.floor(decValue/2); timePortion[curPor] = decMod + timePortion[curPor]; } if (timePortion[curPor].length < maxLength[curPor]) { for (var i = 1; i <= maxLength[curPor] - timePortion[curPor].length; i++) { temp += "0"; } } timePortion[curPor] = temp + timePortion[curPor]; температура = ""; } movingtime = '<table border="0" cellpadding="0" cellpacing="0"><tr><td bgcolor='+hoursBackground +'><font color='+ textColor +'>' + timePortion[0 ] + '</font></td><td bgcolor='+ двоеточие +'>:</td><td bgcolor='+ минутыBackground +'><font color='+ textColor +'>' + timePortion[ 1] + '</font></td><td bgcolor='+colonBackground +'>:</td><td bgcolor='+ секундыBackground +'><font color='+ textColor +'>' + timePortion [2] + '</font></td></tr></table>'; если (document.layers) { document.layers.clock.document.write(movingtime); документ.слои.часы.документ.закрыть(); } Еще, если (document.all) { clock.innerHTML = movingtime; } setTimeout("syeClock()", 1000) } window.onload = syeClock; </script> <p align="center"> 二进制时钟<br> <span id="lock" style="position:relative;"></span> </p>