parseInt(o.style.zoom,10)||100是什么意思,为什么要||100,
o.style.zoom=zoom+'%'后面的百分比是单位吧.为什么不能直接写"zoom%"
<html> 
<head>   
<meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
<title>新建网页   1</title>   
</head> 
<body> 
<script   language   =   "JavaScript">   
function   bbimg(o){   
var   zoom=parseInt(o.style.zoom,10)||100;
alert(zoom)
zoom+=event.wheelDelta/12;  
if(zoom>0)   o.style.zoom=zoom+'%'
return   false;}   
</script> 
<img   src="http://www.cofc.cn/images/logo.gif"   border=0   onmousewheel="return   bbimg(this)"   onload="javascript:if(this.width>screen.width-600)   
this.style.width=screen.width-600;">       
</body> 
</html

解决方案 »

  1.   

    parseInt(o.style.zoom,10)||100是什么意思,为什么要||100,
    o.style.zoom 转换成10进制整数,如果没有(或者0)就取100,o.style.zoom=zoom+'%'后面的百分比是单位吧.为什么不能直接写"zoom%"上面获取的值,直接写"zoom%"这是一串字符串,也即:style="zoom:zoom%"这是错误的,
    zoom+'%',得到的是 style="100%",其中的100可能是任意整数
      

  2.   

    为什么没有或者0就取100呢,,
    style="zoom:zoom%"没看懂..难道"100%"这个不是字符串吗
      

  3.   

    如果parseInt(o.style.zoom,10)能转换成功则zoom的值是parseInt(o.style.zoom,10),否则zoom的值是100