这取决于您使用的是基础 Dojo 还是旧版 Dojo。我在这个 jsFiddle 中实现了这两个:http: //jsfiddle.net/phusick/PxgZE/
无根据的道场
require([
"dojo/on",
"dojo/query",
"dojo/dom-attr",
"dojo/string",
"dojo/domReady!"
], function(
on,
query,
attr,
string
) {
on(document, "a.cssPauseAll:click", function(event) {
var historyId = attr.get(event.target, "historyID");
query(string.substitute("[itemHistoryID=${0}]", [historyId])).forEach(function(node) {
alert("Baseless Dojo: " + attr.get(node, "ContentID"));
});
})
});
传统道场
dojo.ready(function() {
dojo.connect(document, "a.cssPauseAll:click", function(event) {
var historyId = dojo.attr(event.target, "historyID");
dojo.query("[itemHistoryID=" + historyId + "]").forEach(function(node) {
alert("Legacy Dojo: " + dojo.attr(node, "ContentID"));
});
});
});