首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >从已调用的值中提供条件

从已调用的值中提供条件
EN

Stack Overflow用户
提问于 2014-02-24 02:15:22
回答 1查看 18关注 0票数 0

你好,如果代码已经调用了,我想在javascript中为我的代码添加条件,所以在_edg.source之后它将不再调用:

代码语言:javascript
运行
复制
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>';
            }
        }
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-24 02:17:50

尝试对对象使用条件并在值调用后设置真值,在var _nod之后插入以下代码

代码语言:javascript
运行
复制
check={};
if(check[_nod.label] != true){
......


}
check[_nod.label] = true;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21977753

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档