问答详情
源自:8-3 计时器setInterval()

利用数组和提取split()方法来解决,供大家参考

<script type="text/javascript">

  var attime;

  function clock(){

    var time=new Date();

    var myarr=time.split(" ");

    attime=myarr[4];

    document.getElementById("clock").value = attime;

  }

  setInterval(clock,1000);

</script>


提问者:kenscut 2021-06-13 13:39

个回答

  • ID436
    2021-09-26 23:23:42

    good!