<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?
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.