) { return Math.floor( Math.random() * (max-min+1)+min ); } function reset() { num = getRandom( 1 , 6 ); $(“#result”).hide(1000); times++; $("#timebox").attr("value",'第'+times+'次'); } var num = getRandom( 1 , 6 ); var times = 1; function guess( btn ) { $("#result").html( num ); $("#result").show(3000); if( num > 3 ) { if( btn == „big‟ ) $("#result").html( num + ' : 對'); if( btn == „small‟ ) $("#result").html( num + ' : 錯'); } 37 <div id="result" style="display:none"> 骰子結果 </div> <input type="button" value="大" onclick="guess('big')" /> <input type="button" value="小" onclick="guess('small')" /> <input type=“button” value=“再一次" onclick="reset()" /> <input id="timebox" type="textbox" size="3" value="第1次" onclick="" />