2010-08-24 145 views
0

遇到遞歸問題。螢火蟲說600線:遞歸問題太多

// Recurse if we're merging object values 
    if (deep && copy && typeof copy === "object" && !copy.nodeType) 
    target[name] = jQuery.extend(deep, 
    // Never move original objects, clone them 
    src || (copy.length != null ? [] : {}) 
    , copy); // <--- Line 600 

這裏的源:

$(function() { 
    var $gallery = $('#gallery'), $matcher = $('#matcher'); 

    $('.rotatorImage', $gallery).draggable({ revert: 'invalid', helper: 'clone', appendTo: 'body', cursor: 'move' }); 

    $('.rotatorImage', $galleryItems).draggable({ revert: 'invalid', helper: 'clone', appendTo: 'body', cursor: 'move' }); 

    $matcher.droppable({ 
    accept: '#gallery .rotatorImage, #galleryItems .rotatorImage', drop: function(ev, ui) { 
     copyProduct(ui.draggable, $matcher); 
    } 
    }); 

    function copyProduct($item, section) { 
    if (section.children().length == 0) { 
     var cloneID = 'clone_' + $item.attr('id'); 
     var existing = $('#' + cloneID); 
     if (existing.length == 0) { 
      // then allow it to be created 
      var clone = $item.clone(); 
      clone.attr('id', cloneID); 
      clone.append('<div class="RemoveMatcherItem"><a href="javascript: RemoveItem(\'' + clone.attr('id') + '\');" class="greenlink">x</a></div>').appendTo(section); 
      SaveChanges(); 
     } 
    } 
    else 
     alert('Only one product is allowed at a time for this section.'); 
    } 
}); 

function RemoveItem(cloneID) { 
    $('#' + cloneID).remove(); 
    SaveChanges(); 
} 

function SaveChanges() { 
    SaveMatches(); 
    __doPostBack('<%=lnkSaveMatches.UniqueID%>', '') 
} 

function SaveMatches() { 
    var $rotImg = $('#matcher').find('.rotatorImage'); 

    if ($rotImg.length > 0) { 
     $rotImg.each(function() { 
      var hdn = $('#<%=hdnMatcherID.ClientID%>'); 
      hdn.val($(this).attr('productID')); 
     }); 
    } 
    else 
     $('#<%=hdnMatcherID.ClientID%>').val(''); 
} 

<asp:HiddenField ID="hdnMatcherID" runat="server" /> 
<asp:LinkButton ID="lnkSaveMatches" runat="server" OnClientClick="return SaveMatches();" OnClick="lnkSaveMatches_Click" Text="" /> 
<div id="matcher" class="matcher_" style="width: 120px; height: 120px; border: solid 1px; padding-left: 0px;"> 
    <div class="rotatorImage ui-draggable" id='clone_pid_<%# Eval("ProductID") %>' productid='<%# Eval("ProductID") %>'> 
    <div style="height: 120px;"> 
     <asp:Image ID="imgProduct" runat="server" Width="120" /><br /> 
    </div> 
    <div class="RemoveMatcherItem"><a href="javascript: RemoveItem('clone_pid_<%# Eval("ProductID") %>');" class="greenlink">x</a></div> 
    </div> 
</div> 

protected void lnkSaveMatches_Click(object sender, EventArgs e) { 
    int matchID = hdnMatcherID.Value == "" ? 0 : Convert.ToInt32(hdnMatcherID.Value); 

    Suggestion.UpdateSuggestionItem(matchID); 
} 

在哪裏,我打我的遞歸問題的任何想法?

+0

爲什麼標記爲C#? – NullUserException 2010-08-24 15:46:18

+0

我正在刪除C#標記。另外,不要迂腐,但這個詞是「復發」,而不是「遞歸」。 – 2010-08-24 15:46:41

+0

標籤爲C#,因爲它包含了C#代碼。我對這個錯誤標籤表示歉意。 – pherbio 2010-08-24 15:56:21

回答

0

找到解決我的問題。

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 

將其改爲:

<script type="text/javascript" src="js/jquery/jquery-ui-1.7.2.js"></script> 

感謝那些協助。