我有一个 onclick 执行的函数:
function delete_image() {
//alert;
var result = confirm('Are you sure you want to delete this item?');
if(result) { ....delete the image.... }
}
function new_image() { ....Do SOmething.... }
然后我称之为
<a onclick="setNewUploadOnDelete()">Delete</a>
我需要如果 delete_image 函数的“警报”是“取消”,那么只需停止第二个函数。我尝试下面的代码但不起作用。
function setNewUploadOnDelete() {
var retvalue;
retvalue = delete_image();
if(retvalue == false) { return retvalue; }
return = new_image();
}
请问有什么建议吗?