我想为由ajax生成的所有图像设置绝对位置。如何为ajax生成的图像设置绝对位置
这里是我的代码,
for loop...
var imagediv = document.getElementById('image_layout');
//generate many images
imagediv.innerHTML= imagediv.innerHTML + "<div class='imgDiv'>" + "<a href=\"#\""><img src=\"" + mystuff.list[n].imgPath \"" + "\")\"" + "></a></div>";
//The image shows correctly but I want to set all of them in absolute position so I can create other effects.
我不知道如何做到这一点和感激,如果有人能帮助我在这里。非常感谢!!
你可以只用CSS做到这一点。 '.imgDiv img {position:absolute;}' – ahren 2012-08-06 23:57:17
@ahren是的我知道,但是我的循环会生成很多图像,并且所有图像都会堆叠起来,不确定这里要做什么。 – FlyingCat 2012-08-07 00:02:14