setInterval都会先预执行一遍,才会去全部执行一遍

1、setInterval都会先预执行一遍,才会去全部执行一遍?

2、<!DOCTYPE html>
<html>
<head>

<meta charset="UTF-8"> <title></title> <script>    
 window.onload = function(){        
  var bu = document.getElementsByTagName("button")[0];      
     bu.onclick = function(){            
      setInterval(                  
         function(){                       
           alert("aaa")                      
              var AA = document.getElementById("aa");                       
                var BB = document.getElementById("bb").firstChild;                 
                        AA.appendChild(BB);                     }        
                                     ,3000);         }     } </script>

</head>
<body>
<ul id="aa">

<li>1</li> <li class="cc">楼下的上来</li>

</ul>
<ul id="bb">

<li>2</li> <li>楼上的给我下来别上去</li>

</ul>
<button>点击</button>
</body>
</html>

https://img3.mukewang.com/5bd277e500010c4708330185.jpghttps://img2.mukewang.com/5bd277ed0001449a02000123.jpghttps://img3.mukewang.com/5bd277f70001081308080197.jpghttps://img2.mukewang.com/5bd278000001b96702340124.jpg

慕田峪4524236
浏览 1335回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript