views:

118

answers:

1

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

A: 

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