<%@ta glib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<pre>Bin</pre>
<pre>UPC Code</pre>
<pre>Total Tickets</pre>
<pre>Balance</pre>
<pre>Value</pre>
<pre>Tickets Sold</pre>
<pre>Total</pre>
<pre>End of Life</pre>
<c:forEach items="${scratchlistlotto }" var="sl">
<input name="scratchid" type="hidden" id="scratchid" value="${sl.scratchid }" />
<input name="binid" type="text" class="table_color1" id="binid" value="${sl.bin }" />
<input name="upccode" type="text" id="upccode" value="${sl.upccode }" /></td>
<input name="totalticketss" type="text" id="totalticketss" value="${sl.totaltickets }"/>
<input name="openingbalance" type="text" id="openingbalance" value="${sl.closingbalance }" />
<input name="closingbalnce" type="text" id="closingbalnce" onchange="javascript:Total(this.value)" />
<input name="value" type="text" id="value" size="6" value="${sl.values }" />
<input name="ticketssold" type="text" id="ticketssold" />
<input name="total" type="text" id="total" />
<input type="text" name="hidden" value="${sl.i }"/>
<input name="endoflife" type="checkbox" class="text_border" id="endoflife" /></td>
</c:forEach>
JS
function Total(v) {
var closingbalnce = parse Float(v);
var openingbalance = document.getElementById["openingbalance"].value;
var ob = document.getElementById["closingbalnce"].value;
alert("hiiii "+ob);
alert("closingbalnce "+openingbalance);
var totalscratchtotal = parseFloat(document.name.totalscratchtotal.value);
var ts = closingbalnce-openingbalance;
document.name.ticketssold.value = ts;
var value = parseFloat(document.name.value.value);
document.name.total.value = ts *value;
document.name.totalscratchtotal.value = totalscratchtotal + (ts * value);
}
我使用jSTL标签在jsp页面中显示我的列表值,我的数组列表是(scratchliSTLotto),当我将期末余额放入>文本框时,请帮助我,我想将期初余额发送到java脚本方法中
最佳答案
您可以像这样将列表中的值传递给 js 方法
<script>Total('${sl.closingbalance }')</script>
关于java - 如何将jsp页面中显示的列表值传递到java中的javascript方法中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22855661/