JS递归

2020-3-5 admin JS

<script>
var i=0;

window.onload=function(){
   test();
}

function test(){
  if(i==1){
  console.log(1);
}else{
  i++;
  console.log(2);
  this.test();
}
}

</script>

评论(0) 浏览(1312)

for循环隔几秒执行循环

2020-3-5 admin JS

<script>
for(let i = 0; i < 5; i++){
        setTimeout(()=>{
            console.log(i);
        }, 800 * i);
    }
</script>

评论(0) 浏览(1076)

循环点击(避免重复点击)

2016-5-26 admin JS

   for(var i=0;i<muiTableViewCell.length;i++){
    (function(index) {
     muiTableViewCell[i].addEventListener('tap',function(){
      if(!myapp_js.check_login()){
       ca.prompt('请先登录');
       return;
      }
      if(index == 1){
       ca.newInterface({
        url:'msg.html',
        id:'msg',
        styles:{
            top:'0px',
        bottom:'',
        width:'',
        height:''
        },
        showType:'zoom-fade-out',
            showTime:200
       });
      }
     });
    })(i);
   }

标签: js

评论(0) 浏览(3101)

Powered by emlog 吉ICP备15003877号