【发布时间】:2021-05-17 16:21:46
【问题描述】:
我在 jsp 的遗留项目中有以下代码:
<tr>
<th colspan="2">Customer</th>
<td colspan="2">
<a href="myAction.do" target="view">CustomerLink</a></td>
</tr>
我希望在单击 CustomerLink 时对行为进行少许修改。我只想在执行操作之前在 Javascript 函数中进行一些处理。 我没有了解如何在 Javascript 函数中模拟 href 链接行为?
我尝试了什么:-
<tr>
<th colspan="2">Customer</th>
<td colspan="2">
<a href="javascript:customerLinkClicked('myAction.do')" target="view">CustomerLink</a></td>
</tr>
// Javascript函数
function customerLinkClicked(path)
{
// simulate the href link behaviour, not sure how to do this
}
【问题讨论】:
标签: javascript jakarta-ee dom-events href