嗨,它需要 3 次点击来使用我的 javascript 确认提示执行任何命令。我所有的代码都嵌套在一个句柄请求 ajax 函数中。这是我的代码,我不知道它为什么这样做?
closeButton.onclick = function() {
node.setData('alpha', 0, 'end');
node.eachAdjacency(function(adj) {
adj.setData('alpha', 0, 'end');
var requestone = createRequest();
var deletenode = node.id;
var vars = "deletenode=" + encodeURIComponent(deletenode);
requestone.open("POST", "deletenode.php", true);
requestone.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
if (confirm('Are you sure you want to delete this species from the Database?')) {
requestone.onreadystatechange = function()
{
handleRequest(requestone);
};
requestone.send(vars);
fd.fx.animate({
modes: ['node-property:alpha',
'edge-property:alpha'],
duration: 500
});
} else
{
// Do nothing!
}
});