例如:
<div class="content">
<logic:notEmpty name="answerPage" property="list" scope="request">
<% int i = 0; %>
<logic:iterate id="answer" name="answerPage" property="list" scope="request">
---->>>这里 <span id="span<%=i++ %>">${answer.problemAnswer }</span>
<br />
<div class="answerinfo">
<logic:equal value="1" name="ProblemSubjectForm" property="model.status">
<c:if test="${employee.loginId == answer.createManCode}">
<input name="button1" type="button" class="long_btn" value="修改回答" onclick="modify('span<%=i++ %>')" /> <<-----这是提交给JS的方法
</c:if>
<c:if test="${employee.loginId == ProblemSubjectForm.model.crateManCode}">
<input name="button" type="button" class="long_btn" value="定为最佳答案" onclick="setAnswer(${answer.answerId})" />
</c:if>
</logic:equal>
<div class="userinfo"><span class="gray">回答者:</span> <span class="blue"><c:choose><c:when test="${answer.createManName == '匿名'}">${answer.createManName}</c:when>
<c:otherwise><a href="javascript:showUserInfo('${answer.createManCode}')">${answer.createManName}</a></c:otherwise></c:choose></span>
<span class="gray"><bean:write name="answer" property="createTime" format="yyyy-MM-dd hh:mm:ss"/></span></div>
</div>
<div class="dotted"></div>
</logic:iterate>
</logic:notEmpty>
</div>
</div>
另外 js里面的方法是 function modify(obj){
"获得SPAN的值"
}
js里面
function modify(obj)
{
alert(obj); ------显示ID
alert(document.getElementById('obj').innerText);----不显示值
}