怎样实现用鼠标中轴滚轮来控制图片的大小缩放许多BBS中都有贴图的功能,因为每幅图大小不同,所以就有了代码实现用标中轴滚轮来控制图片的大小缩放,本人找了半天没找到,大家帮个忙吧找到了,跟帖或者回邮件也可,
[email protected]以前的版本是初始图片的大小:onload="javascript:if(this.width>screen.width-500)this.style.width=screen.width-500;"EG:<img src="http://00000000.net.cn/200606/200606000/tgx.jpg" onmousewheel="return sdZoom(this)" onload="javascript:if(this.width>screen.width-500)this.style.width=screen.width-500;"> 放大缩小图片:<script>//放大缩小图片function sdZoom(o){var zoom=parseInt(o.style.zoom, 10)||100;zoom =event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom '%';return false;}</script>EG:<img src="http://00000000.net.cn/200606/200606000/tgx.jpg" onmousewheel="return sdZoom(this)" onload="javascript:if(this.width>screen.width-500)this.style.width=screen.width-500;"> 先加上这段js代码:<SCRIPT language=JavaScript>function bbimg(o){var zoom=parseInt(o.style.zoom, 10)||100;zoom =event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom '%';return false;}</SCRIPT>然后这样用:<img SRC="yuorimage" border=0 onmousewheel="return bbimg(this)" >即可。markmark