-1

需要一些帮助的setTimeout()方法。

我在这里有以下代码:

我需要能够删除 newState 变量的实例。认为我做错了。请协助。提前致谢。

var deleteState = setTimeout("alert('Object has been removed')" , 2000);
newState.mousedown(function(e) {
    if (deleteState == 0) {
        clearTimeout(deleteState);
    }

    jsPlumb.detachAllConnections($(this));
    $(this).remove();
    e.stopPropagation();
}); 
4

1 回答 1

-1

尝试这个:

var deleteState = setTimeout(function(){alert('Object has been removed') } , 2000);

来源:http ://www.w3schools.com/js/js_timing.asp

于 2014-02-20T12:15:45.173 回答