jquery在网页实时显示时间;

1.定义一个显示时间的位置

<div id="shijian">
                  
              </div>

2.jquery代码

function showTime() {
                var curTime = new Date();
                $("#shijian").html(curTime.toLocaleString());
                setTimeout("showTime()", 1000);
                 }
                    $(function(){
                        showTime()
                    })

 

posted @ 2017-01-22 16:31  88旧港  阅读(639)  评论(0)    收藏  举报