Html 单击按钮时新的onclick返回
下面是现有代码,但我想添加一个新的onclick,它返回一个弹出框,询问用户是否确定要删除配置文件。但是我想不出来 现行守则:Html 单击按钮时新的onclick返回,html,model-view-controller,onclick,return,Html,Model View Controller,Onclick,Return,下面是现有代码,但我想添加一个新的onclick,它返回一个弹出框,询问用户是否确定要删除配置文件。但是我想不出来 现行守则: @if(mode == "Edit"){ <div class="Delete"><a class="btn btn-danger" href ="@Url.Action("Delete", "GPS", new { Id = Model.provider.Company.Id.Value, oem = Model.provider.
@if(mode == "Edit"){
<div class="Delete"><a class="btn btn-danger" href ="@Url.Action("Delete", "GPS", new { Id = Model.provider.Company.Id.Value, oem = Model.provider.Id})">Delete Profile</a></div>
}
在js中,应该是这样的:
if (confirm('Are you sure you want to delete the profile?')){
// code to execute if ok is pressed
// in your case it could be a redirection to the url you need
} else {
// code if canceled is pressed, may not be used
}
需要知道的是,它是有效的,因为如果确定,确认将返回true,如果取消,则返回false
if (confirm('Are you sure you want to delete the profile?')){
// code to execute if ok is pressed
// in your case it could be a redirection to the url you need
} else {
// code if canceled is pressed, may not be used
}