下面的代码不起作用。
没有confirm
它可以正常工作,但confirm
无法正常工作。
<a href="@Url.Action ("action" , "controller" , new {idd=item.id } , new { onclick="return confirm ( ' are you sure ?');"})">
<Img src=@Url.Content ("~/Content/icons/tag.icon")" />
</a>
答案 0 :(得分:0)
Url.Action没有像某些Html助手那样的htmlAttributes参数等。只需将onclick =“...”直接添加到'a'标签。
<a href="@Url.Action("Test2", "Home", new { idd = 2 })" onclick="return confirm('are you sure?');">