如何從函數內部調用函數,使其成爲遞歸?這裏是我的代碼,我添加了一個評論,我想開始遞歸:JQuery遞歸函數?
$('a.previous-photos, a.next-photos').click(function() {
var id = $('#media-photo img').attr('id');
var href = $(this).attr('href');
href = href.split('/');
var p = href[href.length - 1];
var url = '/view/album-photos/id/' + id + '/p/' + p;
$.get(url, function(data) {
$('.box-content2').replaceWith('<div class="box-content2"' + data + '</div>');
});
// here I want to call the function again
return false;
});
是否有可能獲得完整的樣本?我還沒有能夠做到這一點,但... – krdluzni 2009-09-02 17:06:43
鏈接的網站有一個創建匿名遞歸階乘函數的例子。 – jimr 2009-09-02 17:39:50
agruments.callee已棄用。請參閱http://stackoverflow.com/questions/103598/why-was-the-arguments-callee-caller-property-deprecated-in-javascript – 2013-08-16 11:43:41