<span id="localtime"><span> <script type="text/javascript"> function showLocalTime(OID) { window.setTimeout(function(){ var today = new Date(), arr = new Array(‘日‘, ‘一‘, ‘二‘, ‘三‘, ‘四‘, ‘五‘, ‘六‘), yy = today.getYear(), mm = today.getMonth()+1, dd = today.getDate(), hh = today.getHours(), ii = today.getMinutes(), ss = today.getSeconds(), ww = today.getDay(); yy = yy < 1900 ? yy + 1900 : yy; mm = mm < 10 ? ‘0‘ + mm : mm; dd = dd < 10 ? ‘0‘ + dd : dd; hh = hh < 10 ? ‘0‘ + hh : hh; ii = ii < 10 ? ‘0‘ + ii : ii; ss = ss < 10 ? ‘0‘ + ss : ss; document.getElementById(OID).innerHTML = yy + ‘-‘ + mm + ‘-‘ + dd + ‘ ‘ + hh+‘:‘+ii+‘:‘+ss + ‘ 星期‘ + arr[ww]; showLocalTime(OID); }, 1000); } showLocalTime(‘localtime‘);
JavaScript 时间显示
时间: 2024-11-02 01:26:22