複製程式碼 程式碼如下: <br><br> /*根据获得焦点的时候给setVal给值*/ <br> var setVal; <br> var bool = false; <br> var scrollFunc=function(e){ <br> var direct=0; <br> e=e || window.event; <br> var ew = e.wheelDelta <br> if(ew && bool){ <br> if(ew > 0){ <br> var num1 = setVal.value; <br> if(num1 > 0){ <br> num1 = eval(1+parseInt(num1)); <br> }else{ <br> num1 = 1; <br> } <br> }else{ <br> var num1 = setVal.value; <br> if(num1 > 0){ <br> num1 = eval(parseInt(num1)-1); <br> }else if(num1 == 0){ <br> num1 = 0; <br> }else{ <br> num1 = 1; <br> } <br> } <br><br> setVal.value = num1; <br> } <br><br> } <br> window.onmousewheel=document.onmousewheel=scrollFunc; <br><br> function ufocus(eve){ <br> bool = true; <br> setVal = eve; <br> } <br><br> function ublur(){ <br> bool = false; <br> setVal = null; <br> } <br> <br><br> /*根據取得焦點的時間給setVal給值*/<BR> var setVal; <BR> var bool = false; <BR> var scrollFunc=function(e){<BR> var ew = e. wheelDelta<BR> if(ew && bool){<BR> if(ew > 🎜> if(num1 > 0){<BR> (num1));<BR> }else{<BR> }<BR> }else{<BR> if(num1 > 0){<BR> num1 = eval(parseInt(num1)-1);<BR> } num1 = 0;<BR> 1;<BR> } <BR> }<BR><BR> setVal.value = num <BR> window.onmousewheel=document.onmousewheel=scrollFunc;<BR><BR> function ufocus(eve){<BR> 🎜> }<BR><BR> function ublur(){<br> bool = false;<br> setVal = null;<BR> }<br>