美文网首页前端文档记录
2017-0317-全国空气质量指数

2017-0317-全国空气质量指数

作者: Exap | 来源:发表于2017-03-17 07:51 被阅读0次

全国空气质量指数

window.onload=function(){

console.log(setInterval(init,1500));//文档加载完成之后就开始每隔1.5秒执行init函数

console.log(true)

}

function init(){

//copycity函数会渲染文档节点,在此之前li节点的长度为o

//通过判断li的节点长度,在小于400之前,执行渲染文档

//在渲染文档执行完成后,则清除setinterval的函数

//setinterval开始执行时会返回一个数字,代表该interval的id,可用于clearinterval消除

console.log("is checking");

if($("li").length<400){copyCity()}else{clearInterval(1);clearInterval(2);console.log("the li's length is "+$("li").length+" ,it's check complete.")};

}

相关文章

网友评论

    本文标题:2017-0317-全国空气质量指数

    本文链接:https://www.haomeiwen.com/subject/xjgsnttx.html