js 定时器还有元素添加删除
setInterval(function(){},1000)定时器;
clearInterval()取消定时器;
setTimeout(function(){},1000);
定时器的日期
var myVar=setInterval(function(){myTimer()},1000);
function myTimer(){
var d=new Date();
var t=d.toLocaleTimeString();
document.getElementById("demo").innerHTML=t;
}
元素的添加
// var p = document.createElement('p');
// var nod = document.createTextNode('新段落');
// p.appendChild(nod)
// document.getElementById('ids').appendChild(p)
浙公网安备 33010602011771号