如显示时间:

<script>
//获取时间
function mytime(){
var a = new Date();
var b = a.toLocaleTimeString();
var c = a.toLocaleDateString();
document.getElementById("time").innerHTML = "当前时间:"+"&nbsp"+c+"&nbsp"+b;
}
setInterval(mytime,1000); //mytime是方法,1000表示每1秒执行一次
</script>

<body>
<p ></p>
</body>

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-06-27
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-03
  • 2022-12-23
  • 2021-05-31
  • 2021-06-01
相关资源
相似解决方案