本来要实现在页面中载入多个iframe,而iframe中的数据是从SQL查询的,恰好我的iframe是js循环排列的,因为js执行速度的原因,iframe不能显示,

想要在js的循环中,每次执行都停留一段时间让每一个iframe都能加载完全,需要一个函数来停止js的页面元素加载。代码如下:

function sleep(numberMillis) { 

	var now = new Date();

	var exitTime = now.getTime() + numberMillis;  

	while (true) { 

    	now = new Date(); 

   	 	if (now.getTime() > exitTime)    return;

 	}

}

  

相关文章: