87,984
社区成员
发帖
与我相关
我的任务
分享
window.onload = function(){
imgLocating("container","box")
}
function imgLocating(ccontainer,bbox){
var sceenWidth = document.documentElement.clientWidth;
var imgWidth = bbox.offsetWidth;
var cols = Math.floor(sceenWidth/imgWidth);
var l = imgWidth*cols;
ccontainer.style.cssText = "width:"+l+"px; margin:0 auto";
alert(l);
}
imgLocating(document.getElementById("container"),document.getElementById("box"))