鼠标滚轮使图片放大缩小
在有些BBS上看到图片可以用鼠标滚轮放大缩小,这个是怎么实现的啊?图片也找不到鼠标滚轮的事件。
------解决方案-------------------- <%@ Page language= "c# " Codebehind= "WebForm21.aspx.cs " AutoEventWireup= "false " Inherits= "TBT_Admin.NewFolder1.WebForm21 " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<HTML>
<HEAD>
<title> WebForm4 </title>
<meta name= "GENERATOR " Content= "Microsoft Visual Studio .NET 7.1 ">
<meta name= "CODE_LANGUAGE " Content= "C# ">
<meta name= "vs_defaultClientScript " content= "JavaScript ">
<meta name= "vs_targetSchema " content= "http://schemas.microsoft.com/intellisense/ie5 ">
<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>
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id= "Form1 " method= "post " runat= "server ">
<img src= "\images\denglu_bg.jpg " onload= "javascript:if(this.width> screen.width*0.7)this.style.width=screen.width*0.7; "
onmousewheel= "return bbimg(this) " style= "Z-INDEX: 101; LEFT: 104px; POSITION: absolute; TOP: 0px ">
</form>
</body>
</HTML>
------解决方案--------------------来迟一步,楼上说得没错
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 z=parseInt(o.style.zoom, 10)||100;
z+=event.wheelDelta/12;
if (z> 0){z=z+ "% ";o.style.zoom=z;}
return false;
}