1、setInterval都會(huì)先預(yù)執(zhí)行一遍,才會(huì)去全部執(zhí)行一遍?
2、<!DOCTYPE html>
<html>
<head lang="en">
<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">樓下的上來(lái)</li>
</ul>
<ul id="bb">
<li>2</li> <li>樓上的給我下來(lái)別上去</li>
</ul>
<button>點(diǎn)擊</button>
</body>
</html>