[Dojo-interest] IE issue: dojo.connect does not work for img objects.

Alpana Tiwari alpana at us.ibm.com
Fri Mar 12 15:52:25 EST 2010


Hi Pankaj,

I have been trying to use dojox.gfx  to and have been unsuccessful in 
getting images to render in FF3.5 or IE 7.  I found your code below on the 
web - did you ever get it to work in these browsers.  Thanks in advance.

<html>
<head>
<title>Dojo connect - image</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
                 @import "../../../dojo/resources/dojo.css";
</style>
<script type="text/javascript" src="../../../dojo/dojo.js"
djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("dojo.parser"); // scan page for widgets
dojo.require("dojox.gfx");
var surface, grid_1;

var image_array = new Array(); 
var makeShapes = function()
{
                 surface = 
dojox.gfx.createSurface(dojo.byId("gfx_holder"), 500, 500);
                 grid_1 = surface.createGroup();
                 image_array[0] = grid_1.createImage({x: 100, y: 100, 
width:15, height: 15,
src: "idle.bmp"});
                 dojo.connect(image_array[0].getEventSource(), 'onclick', 
'callJavascript');
};

dojo.addOnLoad(makeShapes);

function callJavascript(event)
{
                 if (event.target == image_array[0].rawNode)
                 {
                                 alert("Test Complete");
                 }
                 else
                 {
                                 alert("Call is made to function but the 
object instance is not matching. I
am sure you are on IE.");
                 }
}
</script>

</head>
<body>
                 <div id="gfx_holder"></div>
</body>
</html>




Alpana Tiwari
Advisory Software Engineer
Ph: (914) 784 7916, tieline 8-863-7916
Fax: (914) 784 6225
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20100312/462af077/attachment.htm 


More information about the Dojo-interest mailing list