【发布时间】:2014-10-04 21:21:52
【问题描述】:
<table border="1" cellpadding="5" id="newtable">
<tr>
<th>Room No</th>
<th>AC</th>
<th>Deluxe</th>
<th>Tariff</th>
</tr>
<c:forEach var="room" items="${myrooms}">
<tr bgcolor="#4B476F" onMouseOver="this.bgColor='gold';" onMouseOut="this.bgColor='#4B476F';">
<td class="nr"><c:out value="${room.roomno}" /></td>
<td><c:out value="${room.ac}" /></td>
<td><c:out value="${room.deluxe}" /></td>
<td>₹<c:out value="${room.price}" /></td>
<td><button type="button" class="mybutton" onclick="rowFunction()">Pay</button> </td>
</tr>
</c:forEach>
</table>
单击与每一行对应的按钮时,我希望我的脚本返回房间号,即该行的第一个单元格数据。在参考了网上各种文章后,我尝试了很多东西。似乎没有任何效果。请帮忙。我要求您不要发布任何 JQUERY 解决方案。只有 JAVASCRIPT。谢谢!
【问题讨论】:
标签: javascript html dom javascript-events