setTimeout用法

var gTimes = 0;
var bNum = "";
gunNum($(".page"));
function gunNum($obj){
    bNum +=  Math.floor(Math.random()*9);
    $obj.text(bNum);
    gTimes++;
    if(gTimes < 5)
    {
        //setTimeout(gunNum,200,$obj);不兼容ie
        setTimeout(function(){gunNum($obj)}, 200);
    }    
    else
    {
        $obj.text(tnbNum);
    }    
}

 

posted @ 2015-10-30 17:42  hpyou  阅读(159)  评论(0编辑  收藏  举报