var zoom=parseInt(o.style.zoom, 10)||100 中||是什么意思

来源:百度知道 编辑:UC知道 时间:2024/05/15 08:51:00
var zoom=parseInt(o.style.zoom, 10)||100 中为何要与100相||

onmousewheel是鼠标滚轮事件,是IE6的对象的新事件;style.zoom,event.wheelDelta是IE6的对象的新属性,style.zoom是变大缩小,未赋值前返回null,赋值成XX%,就变化为XX%,并返回XX%;event.wheelDelta是滚轮滚动一下的角度,上滚一下为120,下滚一下为-120,注释一下代码吧:
<script>
function bbimg(o){
var zoom=parseInt(o.style.zoom, 10)||100;//如果style.zoom为null,则为100,否则为style.zoom
的值
zoom+=event.wheelDelta/12;//根据滚动的方向令zoom加10或减10
if (zoom>0) o.style.zoom=zoom+'%';//把zoom的值赋style.zoom
return false;//返回假
}
</script>