以文本方式查看主题

-  泥客论坛(十几年前的回忆)  (http://kesonic.com/bbs/index.asp)
--  ☆网页制作☆  (http://kesonic.com/bbs/list.asp?boardid=81)
----  限制签名图片的大小  (http://kesonic.com/bbs/dispbbs.asp?boardid=81&id=6835)

--  作者:小轲
--  发布时间:2004/12/2 22:49:29

--  限制签名图片的大小

修改inc\\main.js文件,在第201行左右,找到

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 bbimg(o){

// var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+\'%\';

// return false;}

或者修改:把inc\\Dv_ubbcode.asp 中的这个部分(大概在291行)

If ssize=500 Then

   s=re.replace(s,"<img$1 onmousewheel=""return bbimg(this)"" onload=""javascript:if(this.width>screen.width-"&ssize&")this.style.width=screen.width-"&ssize&";"">")

  Else

   s=re.replace(s,"<img$1 onmousewheel=""return bbimg(this)"" onload=""javascript:if(this.width>screen.width-"&ssize&")this.style.width=screen.width-"&ssize&";if(this.height>250)this.style.width=(this.width*250)/this.height;"">")

If ssize=500 Then

   s=re.replace(s,"<img$1onmousewheel=""return bbimg(this)"" onload=""javascript:if(this.width>screen.width-"&ssize&")this.width=screen.width-"&ssize&";"">")

  Else

   s=re.replace(s,"<img$1onload=""javascript:if(this.width>screen.width-"&ssize&")this.width=screen.width-"&ssize&";if(this.height>100)this.height=100;"">")

  End If

1、修改if(this.height>100)this.height=100;  为:if(this.height>100)this.style.height=100;  这样做可以保证大部分图片按比例缩放,只有少数特殊的图片会被变形。

2、修改if(this.height>100)this.height=100; 为:if (this.height>100){var rate=100 / this.height;this.style.width=this.width * rate;}