我在 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
}