2014-02-24 80 views
0

你好,我想提出的条件我在JavaScript代码,如果代码已经被称为价值提供条件,所以_edg.source后它不会再次呼吁:从呼吁

for (var j in GexfJS.graph.edgeList) { 
    var _edg = GexfJS.graph.edgeList[j] 
    if ((_edg.target == _curra) && (_edg.source != _nodeIndex) && (_edg.target != _n)) { 
     var _nod = GexfJS.graph.nodeList[_edg.source]; 

     if(_n != _nod){ 
      _str += '<li><div class="smallpill" style="background: ' + _nod.color.base +'"></div><a href="#" onmouseover="GexfJS.params.activeNode = ' + _edg.target + '" onclick="displayNode(' + _edg.target + ', true); return false;">' + _nod.label + 'b</a>' + (GexfJS.params.showEdgeWeight && _edg.weight ? ' [' + _edg.weight + ']' : '') + '</li>'; 
      } 
     } 
    } 
} 
+0

看看这有助于你的下一个问题http://jsbeautifier.org/ – elclanrs

回答

0

尝试使用条件与物体设定的值呼吁后的真正价值,插入此代码的变种后_nod

check={}; 
if(check[_nod.label] != true){ 
...... 


} 
check[_nod.label] = true;