Within the loop of the jsp page, call the js function, and the js function can only get the data in the first loop.

<c:forEach items="${zhiweilist}" var="bean">
            <tr>
                <td><a href="-sharp-sharp-sharp-sharp" onclick="zhiweishow(${bean.id })">${bean.zhiweileibie.name }</a></td>
                <span id="leibie" style="display:none;">${bean.zhiweileibie.name }</span>
                <td>${bean.zhiweimingchen }</td>
                <span id="mingcheng" style="display:none;">${bean.zhiweimingchen }</span>
                <td>${bean.yuexin }</td>
                 <span id="yuexin" style="display:none;">${bean.yuexin }</span>
                 <td><a href="-sharp-sharp-sharp-sharp" onclick="zhiweishow(${bean.id })"></a></td>
                  <td><a href="method!toutijianli?id=${bean.id }" ></a></td>
                  <script type="text/javascript">
                      var leibie = document.getElementById("leibie").innerHTML;
                      var mingcheng = document.getElementById("mingcheng").innerHTML;
                      var yuexin = Number( document.getElementById("yuexin").innerHTML);
                      var type=leibie+mingcheng;
                      window.name_list.push(type);
                      window.price_list.push(yuexin);
                </script>
             </tr>
        </c:forEach>        
The

code is shown in the figure. I want the js function to save the information obtained from each loop, but in fact, there are four identical data (because the input data is four) inside name_list and price_list. How can I solve this problem so as to get the results I want?

The

browser output is shown in the figure. What you get through echarts is a straight line. Check the element, and its value is only one.

Mar.22,2021

with all due respect, this is very skinny. If you know the data, you can just write it in a script tag.


use js to read Datagram 500errors from the back end, which is a rough way to read data from the table on the page

.
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-1e865d2-dcd.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-1e865d2-dcd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?