<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script>
            window.onload=function(){
                var oDiv=document.getElementById("div1");
                var oInput=document.getElementById("input1");
                
                oInput.onclick=function(){
                    var arr=oDiv.innerHTML.split(",");
                    arr.push(arr[0]);  //pop  unshift
                    arr.shift();
                    oDiv.innerHTML=arr;
                    
                }
                
            }
        </script>
    </head>
    <body>
        <div >1,2,3,4</div>
        <input type="button" value="切换" />
    </body>
</html>
 

 

相关文章:

  • 2022-12-23
  • 2021-10-11
  • 2022-12-23
  • 2021-11-24
  • 2021-12-10
  • 2021-09-02
  • 2021-04-08
  • 2021-10-18
猜你喜欢
  • 2022-12-23
  • 2021-10-16
  • 2021-06-08
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案