开发者

making links with out anchor tag using dojo

I have a image with link <div id="img"><a href="src/blah.html"><img src="/src/img.png"/></a></div> but i don't wanna use 开发者_开发知识库 tag for linking.the page has multiple entries like this in a page as it is being populated for a search result.Some 10 or more entries will be there in a page.its all inside a <div id="result"></div>

have an idea for doing it dojo.help me finish that

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; }));


Try the code below:

<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;
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜