![](/img/trans.png)
[英]How to track anchor links using Google Tag Manager and Google Analytics?
[英]making links with out anchor tag using dojo
我有一個鏈接為<div id="img"><a href="src/blah.html"><img src="/src/img.png"/></a></div>
但我不想使用標簽進行鏈接。該頁面在頁面中有多個這樣的條目,因為它正在填充搜索結果。頁面中將有10個或更多條目。它們都在<div id="result"></div>
有一個這樣做的想法dojo.help我完成
function(){ dojo.query('.Result').forEach(function(item){ try{ var href = dojo.query('.img',item)[0] //do things dojo.connect(Node,'onclick',dojo.hitch(this,function(){ window.location = location; }));
請嘗試以下代碼:
<div id="result">
<div class="imageContainer"><img location="src/blah.html" src="/src/img.png"></div>
</div>
dojo.query("#result .imageContainer img").connect("onclick", function() {
var location = dojo.attr(this, "location");
if (location) {
window.location.href = location;
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.