zoukankan      html  css  js  c++  java
  • js for循环中执行带参 setTimeout

    直接放代码吧,我觉得在js代码前词穷

    fun tq()
    {
      var len = hisPlayView.length;
           
      mySetInterval(draw,interval,0); 
      
    }
    function mySetInterval(f,time,param)
    {  
        setTimeout(function(){f(param);},time);  
    }  
    function draw(i)
    {
    if(i >= hisPlayView.length)
    {
    return;
    }
        map.removeOverlay(hisPlaymarker);
        hisPlaymarker = new BMap.Marker(hisPlayView[i]);
        map.addOverlay(hisPlaymarker);
        hisPlayLinePoints.push(hisPlayView[i]);
        polyline.setPath(hisPlayLinePoints);   //设置折线的点数组
        map.addOverlay(polyline);   //将折线添加到地图上  
     
        mySetInterval(draw,100,i+1);
    //alert(i);
    }
     
  • 相关阅读:
    PCA与LDA
    SVM--交叉验证
    git的基本使用
    MySQL的操作
    MySQL安装和远程连接
    javaScript进阶
    javaScript基础入门篇
    javaScript运动
    可变对象和不可变对象
    基本数据类型
  • 原文地址:https://www.cnblogs.com/nygfcn1234/p/3186686.html
Copyright © 2011-2022 走看看