prototype.js defined PeriodicalExecuter object, provide a certain interval of time to repeat the logic of a method call.

<div></div>
<script>
var i = 0;
var p = new PeriodicalExecuter(showTime,0.1); //创建实例。每0.1秒调用一次showTime方法
function showTime(){
	$('time').innerHTML=new Date().toString();
	++i;
	if(i>100){
		p.stop(); //停止
	}
}	
</script>