鼠标滚轮控制图片的放大和缩小
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>鼠标滚轮控制图片的放大和缩小</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<!--把下面代码加到<head>与</head>之间-->
<script language="JavaScript">
<!--
//改变图片大小
function resizepic(thispic){
if(thispic.width>700) thispic.width=700;
}
//无级缩放图片大小
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>
</head>
<body>
在图片上滚动鼠标滚轮试试。<br>
<!--把下面代码加到<body>与</body>之间-->
<img src="http://images.cnblogs.com/zhanghanyun.jpg" width="320" height="240" border="0" onload="javascript:resizepic(this)" onmousewheel="return bbimg(this)">
</body>
</html>