There are a few things I can point out. 1.) You might want to try $('body') instead of $(body) 2.) 'id' is not a CSS attribute, if you wish to change it's value, it should be done like this : $("#hi").attr('id', newid); 3.) [Suggestion] css() accepts a hash : $('#hi').css({ 'top': (y*10), 'left': (x*10) });
Thanks & Regards, Dhruva Sagar. On Sun, Nov 8, 2009 at 3:42 AM, bryre papata <mr.jsn...@googlemail.com>wrote: > i am making an ant game, and i have a problem: > > > var x,y; > for(x = 1; x <= 10; x = x + 1){ > images[x] = { > }; > for(y = 1; y <= 10; y = y + 1){ > images[x][y] = { > }; > $(body).append('<im'+'g id="hi">'); > var newid=x+", "+y; > $("#hi").css('id', newid).css('top',(y*10).css('left', (x*10)) > } > } > > i am pretty sure that there is a problem with the jquery lines, but im not > absolutly sure. > > > The JavaScript revolution has started!!! DOWN WITH FLASH!!! > DOWN WITH FLASH!!! > DOWN WITH FLASH!!! > http://www.chromeexpirements.com >