关于网站自动控制图片大小的代码

来源:百度知道 编辑:UC知道 时间:2024/05/18 09:21:03
}
function bbimg(o){
var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
function imgzoom(img,maxsize){
var a=new Image();
a.src=img.src
if(a.width > maxsize * 4)
{
img.style.width=maxsize;
}
else if(a.width >= maxsize)
{
img.style.width=Math.round(a.width * Math.floor(4 * maxsize / a.width) / 4);
}
return false;
}

我想将图片的宽度控制在575,大于575的缩成575,小于575的扩大成575,请问这段数值如何修改?

}
function bbimg(o){
var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
function imgzoom(img,maxsize){
var a=new Image();
a.src=img.src
if(a.width > maxsize)
{
img.style.width=maxsize-575;
}
else if(a.width < maxsize)
{
img.style.width=maxsize+575);
}
return false;
}

或者
<img border="0" src="[!--picurl--]" onload="if(this.width>screen.width-575)this.style.width=screen.width-575; else if(this.width<screen.width-575)this.style.width=screen.width+575;">