onclick 事件
<a onclick="SetType('10',this);return false;" href="../../123.html"> <img src="../../images/123.png"> <p>sh</p> </a>
<script> function SetType(id, that) { var href = that.href; window.location.href = href; //var url = 'T_User_asda/asda/SetTheState' //var obj = {}; //obj["Id"] = id; //my_post_formdata(apiUrl + url, ToFormData(obj), function (e) { // window.location.href = href; // //alert(1); //}); } </script>
<li onclick="Delsubmit(\'{0}\')" ><div> <img src="../../images/123.png"> <p>删除</p> </div></li>
function Delsubmit(id) {
//var id = this.getAttribute("d-Id");
var data = { "Ids": "" };
data.Ids = id;
var f_Data = ToFormData(data);
//是否删除
var btnArray = ['是', '否'];
mui.confirm('是否删除?', '提示', btnArray, function (e) {
if (e.index == 0) {
//console.log('是');
del();
} else {
//console.log('否');
}
})
function del() {
my_post_formdata(
apiUrl ,
f_Data,
function (e) {
if (e.Success) {
if (e.Data) {
mui.toast("删除成功!");
setTimeout(function () {
window.location.href = window.location.href;
}, 1000);
} else {
mui.toast("删除失败!");
}
} else {
mui.toast(e.Msg);
}
});
}
}