コードをコピー コードは次のとおりです: <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 direct=0;<br> e=e || 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)); 🎜> var num1 = setVal.value > 0){<br> num1 = eval(parseInt(num1)-1);<br> }else if(num1 = = 0){<br>num1 = 0; <br> = 1; <br> <br> window.onmousewheel=document.onmousewheel=scrollFunc;<br><br> 関数 ufocus(eve){<br> bool = true;<br> setVal = eve;<br> }<br><br> 関数ublur(){<br> bool = false;<br> setVal = null;<br> }<br>