如何实现点击一个按钮函数循环开始,点击另外一个函数循环结束?

某个函数disp():

function disp(){
   var a = Math.floor(0+Math.random() * 2);
   var b = Math.floor(2+Math.random() * 3);
   var c = Math.floor(6+Math.random() * 2);

   var data = ["(111,222,333)", "(232,977,888)", "(144,168,303)"];
   var change = function () {
       var rgb_1 = data[Math.floor(Math.random() * 3)];
       return "rgb" + rgb_1 + "";
   }
   squre[a].style.backgroundColor = change();
   squre[b].style.backgroundColor = change();
   squre[c].style.backgroundColor = change();

   setTimeout(function () {
       squre[a].style.backgroundColor = "#ff7b45";
       squre[b].style.backgroundColor = "#ff7b45";
       squre[c].style.backgroundColor = "#ff7b45";
   }, 1000)
}


$("#bt").click(function(){
   某个函数()开始循环执行;

})

$("#bt2").click(function(){
   某个函数();怎么停止?


})

慕粉4415862
浏览 2177回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP