Javascript MVC4中的警报框?
这就是我要为ActionLink制作的警报框。但它不起作用Javascript MVC4中的警报框?,javascript,asp.net-mvc,Javascript,Asp.net Mvc,这就是我要为ActionLink制作的警报框。但它不起作用 @Html.ActionLink("ADD", "BrandListComfirmed", new { id = item.brand_id }, new { onsubmit = "return confirm('Are u sure you want this brand? " + item.brand_name + "');" }) 没有锚的onsubmit事件。改用onclick: @Html.ActionLink(
@Html.ActionLink("ADD", "BrandListComfirmed", new { id = item.brand_id }, new { onsubmit = "return confirm('Are u sure you want this brand? " + item.brand_name + "');" })
没有锚的
onsubmit
事件。改用onclick
:
@Html.ActionLink(
"ADD",
"BrandListComfirmed",
new {
id = item.brand_id
},
new {
onclick = "return confirm('Are u sure you want this brand? " + item.brand_name + "');"
}
)
非常感谢。我可以在db.savechange之前使用控制器中的警报框吗?不可以,
alert
是一个javascript函数,它只能在客户端上使用。控制器在服务器上运行。