用滚轮放大缩小图片缩略图

//初始化图片大小
function resizepic(thispic) 
{ 
if(thispic.width>570) thispic.width=570; 
} 
//使用滚轮时放大或缩小图片
function bbimg(o) 
{ 
  var zoom=parseInt(o.style.zoom, 10)||100; 
  zoom+=event.wheelDelta/12; 
  if (zoom>0) o.style.zoom=zoom+'%'; 
  return false; 
}



<div style="width:640px;overflow: hidden;">
<P align=center>
//target=_blank 在新窗口打开图片
<A href="图片地址" target=_blank>
<IMG onmousewheel="return bbimg(this)" alt="" src="图片地址" onload=resizepic(this) border=0>
</A>
</P>
</div>



很简单吧试试效果吧!
附件不要下载,有密码打不开的,我自己在工程里做的测试。

你可能感兴趣的:(JavaScript,html,jsp)