document.write('
\n' + ' \n' + '
\n' + '\n' + '
\n' + ' \n' + '
\n') /*alert($(window).height()); var sonStyle = document.getElementsByClassName("son"); sonStyle.style.height = $(window).height()-500 + "px";*/ let rootWidth = document.documentElement.clientWidth || document.body.clientWidth; let rootDom = document.querySelector('html'); rootDom.style.fontSize = rootWidth / 10 + 'px'; getnow(); function getnow() { //1、获得当前时间,格式化时间 var now = new Date(); var year = now.getFullYear(); var month = now.getMonth() + 1; if (month < 10) { month = "0" + month; } var date = now.getDate(); if (date < 10) { date = "0" + date; } var hour = now.getHours(); if (hour < 10) { hour = "0" + hour; } var minute = now.getMinutes(); if (minute < 10) { minute = "0" + minute; } var second = now.getSeconds(); if (second < 10) { second = "0" + second; } var nowstr = year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second; //alert(nowstr); //alert(nowstr); //2、显示时间 html //获得标签对象 /*var nowspan=document.getElementById("nowspan"); nowspan.innerHTML=nowstr;*/ //2021-09-30 12:00:00 $("#dateinfo").html(nowstr.slice(0, 10)); $("#timeinfo").html(nowstr.slice(11, 19)); //3、使时间动起来 setTimeout("getnow()", 1000); }