English 中文(简体)
工作会议 登船。 3. 与同类物体相联的多个物体
原标题:dojo eventListener via dojo.connect attach to multiple objects with same id

我试图附上一份有关同<条码>id(“联系......”)

var handle = [];
var link = dojo.query( #linkToDisplay a ).forEach(function(node, index, array){

    handle.push(dojo.connect(node,
        "onclick",
        null,
        function(evt) {
            console.log("mouseup detected, firring off server request");
            dojo.xhrGet({url: default/data/getPageContent?main=true&pageId= +evt.target.name,
                         load: funcCallBack,
                         error: funcError});
            }
          ));

    });

funcError and funcCallBack are下定义和工作(如果我只通过由Dojo.getId检索的单一物体,否则我的文字没有保持沉默)。

我将这一守则放在了登上。 增 编 在Load代码栏目上,我看不到在我点上任何地方时发生的任何事件,因此,我很有理由相信,它不会因为把事件的听众附在DOM的错误片上。

最佳回答

由此看来,如果某些电离层移动装置的补贴与另一个电离层设备相匹配,那么,如果电离层扰动装置只回收第一种电离层。

here is a sample of what I ended up with:

dojo.query(".links a").onclick(function(evt){
                                    dojo.stopEvent(evt);
                                    var link = evt.target;
                                    onSubmit(link)
                                }
                        );

链接具体指明了“连接”类别,然后从这里指任何固定物体,包括后 after,我为浮标活动使用方便功能, gr灭目标,将其交给下游功能(其中包括一些验证和Xhr请求)。

问题回答

为此:

var k=dojo.byId("linkToDisplay");
dojo.connect(k, onclick ,this, yourfunction )




相关问题
Listen for Events from Browser "Find" Window in JavaScript

Is there a way to listen for typing into the browser s "find" window in JavaScript? (source: apple.com) I d like to be able to reinterpret the search text from JavaScript. What do I need to ...

Equivalent of PreviewKeyDown of C# needed for native C++/MFC

I used a ActiveXControl in a C# Forms application and had the possibility to implement a PreviewKeyDown event handler for that ActiveXControl. That was needed to specify that, e.g. the [ALT] key, is ...

Refresh the UI in gwt

I have created some custom composite widget, which listens to an events (in my case loginEvent). Once the event is caught the state of the widget changes so as the way it should look (in my case I ...

How to remove "onclick" with JQuery?

PHP code: <a id="a$id" onclick="check($id,1)" href="javascript:void(0)" class="black">Qualify</a> I want to remove the onclick="check($id,1) so the link cannot be clicked or "check($id,...

热门标签