字符串拆分先进先出

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script type="text/javascript" src="js/jquery.js"></script>
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
            }
            ul,li{ list-style: none; }
            
            .ElecTopW{
                width: 500px;
                height: 60px;
                line-height: 60px;
                
            }
            .TopS1{
                width: 20px;
            }
            .TopS2{
                width: 50px;
                font-size: 16px;
                color: #3254C2;
            }
            .ElecTopLi{
                width: 200px;
            }
            .ElecTopLi,.ElecTopLi li{
                display: inline-block;vertical-align: middle;
            }
            .ElecTopLi li{
                width: 20px;
                height: 30px;
                line-height: 30px;
                font-size: 18px;
                border: 1px solid #0C537C;
                box-shadow: 0 0 6px #0C75A7;
                text-align: center;
            }
        </style>
    </head>
    <body>
        <div class="ElecTopW">
            <span class="TopS1">年总收入</span>
            <ul class="ElecTopLi"><li></li></ul>
            <span class="TopS2">万元</span>
        </div>
        <script>
            $(document).ready(function(){
                 $("li").each(function(){
                     var str = "900080";
                    var Esplit = str.split("",str.length);
                    var newA = new Array() ;
                    var newA = Esplit;
                    var EAlist = " ";
                    for(var i=0;i<9-str.length;i++){
                        EAlist += "<li></li>";
                    }
                    for(var i=0;i<newA.length;i++){
                        EAlist += "<li>" + newA[i] + "</li>";
                    }
                        $(".ElecTopLi").html(EAlist) ;
                    
                    
                });
            });
            
            
        </script>
    </body>
</html>

 

posted @ 2017-11-08 11:30  韩涵39  阅读(176)  评论(0编辑  收藏  举报