1、JavaScript的放大、缩小效果:
<input type=button οnclick=zoom("odiv",1.25) value=放大>
<input type=button οnclick=zoom("odiv",0.8) value=缩小>
<div id=odiv style="width:500px;height:400px;border:2px solid gray;"> </div>
<script>
function zoom(id,rate){
var t=document.getElementById(id).style;
var w=Math.floor(parseInt(t.width)*rate);
var h=Math.floor(parseInt(t.height)*rate);
if(w>20&&h>20){
t.width=w+"px";
t.height=h+"px";
}
}
</script>