I am trying to connect an event, onclick, to an image using dojo.connect, but it just doesn't do anything.
I am using IE11, and I am wondering if this might be the issue or it's something else. I think it's something else as the code doesn't work in Firefox either.
Here's the code I have:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://ift.tt/18dEJrC"
dojoParseOnLoad="true">
<xp:this.resources>
<xp:dojoModulePath url="dojo/_base/connect" loaded="true"></xp:dojoModulePath>
</xp:this.resources>
<xp:image url="/thumb.gif" id="image1" styleClass="thumbsup"></xp:image>
<xp:eventHandler event="onClientLoad" submit="false">
<xp:this.script><![CDATA[
var myImage = dojo.query('thumbsup');
if(!!myImage){
alert('image found');
dojo.connect(myImage,'onclick',window, function() {
alert('image clicked');
});
} else {
alert('image not found')
};
]]></xp:this.script>
</xp:eventHandler>
</xp:view>
It does find the image, but nothing happens when I click on it...
Aucun commentaire:
Enregistrer un commentaire