返回js秒显示当前......登陆

js秒显示当前时间

骑师2018-12-23 17:56:42242

<!DOCTYPE html>

<head>

<meta charset="utf-8">


<script type="text/javascript">

function showTime(){

    

nowtime=new Date();

    

year=nowtime.getFullYear();

    

month=nowtime.getMonth()+1;

    

date=nowtime.getDate();

    

document.getElementById("mytime").innerText=year+"年"+month+"月"+date+" "+nowtime.toLocaleTimeString();

}


setInterval("showTime()",1000);



</script>


</head>


<body>


<span id="mytime"></span>


</body>


</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送