通过鼠标中间滚轮来缩放图片大小
 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default12.aspx.cs" Inherits="Default12" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default12.aspx.cs" Inherits="Default12" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!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">
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
<head runat="server"> <title>无标题页</title>
    <title>无标题页</title> </head>
</head> <body>
<body> <form id="form1" runat="server">
    <form id="form1" runat="server"> <img onmousewheel="return bbimg(this)" src="images/__scale__1_227959004.gif" />
        <img onmousewheel="return bbimg(this)" src="images/__scale__1_227959004.gif" /> <span style="font-weight: bold">Size = <span id="oCounter" style="color: red;">100%</span></span>
        <span style="font-weight: bold">Size = <span id="oCounter" style="color: red;">100%</span></span> <img id="oImage" src="images/__scale__1_227959004.gif" onmousewheel="return Picture();" />
        <img id="oImage" src="images/__scale__1_227959004.gif" onmousewheel="return Picture();" /> </form>
    </form> </body>
</body> </html>
</html>
 <script language="JavaScript" type="text/javascript">
<script language="JavaScript" type="text/javascript">   function bbimg(o){
function bbimg(o){ var zoom=parseInt(o.style.zoom,10)||100;
var zoom=parseInt(o.style.zoom,10)||100; zoom+=event.wheelDelta/12;
zoom+=event.wheelDelta/12; if(zoom>0) o.style.zoom=zoom+'%';
if(zoom>0) o.style.zoom=zoom+'%'; return false;}
return false;} 
   var count = 10;
var count = 10;   function Picture()
function Picture()   {
{   count = Counting(count);
count = Counting(count);   Resize(count);
Resize(count);   return false;
return false;   }
}  
 function Counting(count){
function Counting(count){   if (event.wheelDelta >= 120)
if (event.wheelDelta >= 120)   count++;
count++;   else if (event.wheelDelta <= -120)
else if (event.wheelDelta <= -120)   count--;
count--;   return count;
return count;   }
}  
 function Resize(count){
function Resize(count){   if (count >=1){
if (count >=1){ document.getElementById("oImage").style.zoom = count + '0%';
document.getElementById("oImage").style.zoom = count + '0%';   oCounter.innerText = count + '0%';  }
oCounter.innerText = count + '0%';  } }
}   </script>
</script> 
                    
                     
                    
                 
                    
                


 
                
            
         
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号