<script>
function onWheelZoom(obj){
zoom = parseFloat(obj.style.zoom);
tZoom = zoom + (event.wheelDelta>0 ? 0.05 : -0.05);
if(tZoom<0.1 ) return true;
obj.style.zoom=tZoom;
return false;
}
function small(){
var image0 = document.getElementById('image0');
var height1=image0.height;
var width1=image0.width;
image0.height=height1/1.1;
image0.width=width1/1.1;
}
function big(){
var image0 = document.getElementById('image0');
var height1=image0.height;
var width1=image0.width;
image0.height=height1*1.1;
image0.width=width1*1.1;
}
</script>
<img src="1.jpg" name="image0" id="image0" style="zoom:1;" onmousewheel='return onWheelZoom(this)' />
<input type="button" name="Submit" value="Enlarge" οnclick="big()" />
<input type="button" name="Submit2" value="Narrow" οnclick="small()" />
转载于:https://www.cnblogs.com/xinzhuangzi/archive/2009/11/09/4100649.html