我有这个代码,我希望它只在点击时运行。但是,问题是无论是否单击该按钮,scriptlet notificationDAO.read()
始终在运行。
HTML:
<div style="word-wrap: break-word;">
<li>
<a onclick="read();">
<span class="message" style="color: gray;">
</span>
<span class="subject">
<span class="time" style="color: gray;">
Mark All as Read
</span>
</span>
</a>
</li>
</div>
使用Javascript:
function read() {
<%
notificationDAO.read(((User)session.getAttribute("user")).getEmployeeID());
%>
}