Baidu Map js api multiple coverage add event problem

I want to click on the index corresponding to a different polygon prompt, but now only the last one pops up. I closed it. Is there a problem?
Please answer, online, etc.

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html,-sharpallmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"";}
    </style>
    <!--<script type="text/javascript" src="json.js" ></script>-->
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=zga15SpUh7sMrZkXaBKicRBshkN3bKtR"></script>
    <title></title>
</head>
<body>
    <div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
    // API
    var map = new BMap.Map("allmap");
    var pointArray = [];
    map.centerAndZoom(new BMap.Point(116.403765, 39.914850), 5);
    map.enableScrollWheelZoom();
    var oneDev = ["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""];
    var colorArr = ["-sharpff541c","-sharp1cecff","-sharp3cff1c","-sharpff1c47"];
    boundary();
    function boundary(){
        for(var j=0;j<oneDev.length;jPP){
            var bdary = new BMap.Boundary();
            bdary.get(oneDev[j], function(rs){  //
                var ply = null;
                //map.clearOverlays();        //       
                var count = rs.boundaries.length; //
                for (var i = 0; i < count; iPP) {
                    var color = colorArr[Math.floor(Math.random()*3+0)];
                    ply = new BMap.Polygon(rs.boundaries[i], {fillColor:color,strokeWeight: 2, strokeColor:"-sharp000"}); //
                    map.addOverlay(ply);  //
                }  
                //map.setViewport(pointArray);    //  
                (function(){
                    var index = j;
                    ply.addEventListener("click",function(){
                        alert(j);
                    })
                })
            }); 
        }
    }
    //getBoundary();
</script>
Mar.18,2021

resolved

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html,-sharpallmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"";}
    </style>
    <!--<script type="text/javascript" src="json.js" ></script>-->
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=zga15SpUh7sMrZkXaBKicRBshkN3bKtR"></script>
    <title></title>
</head>
<body>
    <div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
    // API
    var map = new BMap.Map("allmap");
    var pointArray = [];
    map.centerAndZoom(new BMap.Point(116.403765, 39.914850), 5);
    map.enableScrollWheelZoom();
    var oneDev = ["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""];
    var colorArr = ['-sharpff541c','-sharp1cecff','-sharp3cff1c','-sharpff1c47'];
    boundary();
    function boundary(){
        for(var j=0;j<oneDev.length;jPP){
            (function(index){
                var bdary = new BMap.Boundary();
                bdary.get(oneDev[index], function(rs){  //
                    var ply = null;
                    //map.clearOverlays();        //       
                    var count = rs.boundaries.length; //
                    for (var i = 0; i < count; iPP) {
                        var color = colorArr[Math.floor(Math.random()*3+0)];
                        ply = new BMap.Polygon(rs.boundaries[i], {fillColor:color,strokeWeight: 2, strokeColor:'-sharp000'}); //
                        map.addOverlay(ply);  //
                    }  
                    //map.setViewport(pointArray);    //  
                    ply.addEventListener('click',function(){
                        alert(index)
                    })
                });
            })(j)
        }
    }
</script>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bfd1db-316ac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bfd1db-316ac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?