乐天做的一个转盘程序,想用,但是看起来好像每一格抽中的几率是均等的。我想让某几格抽中的几率小一点,该怎么设置。求大牛指导
部分代码如下
<script> $(function() { $('#turntablebtn').click(function() { turnturntable(); }); }); function Cxmlhttp() { //xmlhttp组件创建 try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { xmlhttp = false; } } if(!xmlhttp && typeof XMLHttpRequest != 'undefined') { xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function turnturntable() { $('#turntablebtn').css('display', 'none'); xmlhttp = Cxmlhttp(); xmlhttp.open('GET', 'index.php?c=app&a=puyuetian_turntablegame:turn'); xmlhttp.send(null); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { result = parseInt(xmlhttp.responseText); if(result < 9) { tiptext = $('.t-' + result).html(); var i, turni = 1; var turn = setInterval(function() { if(16 < parseInt(turni)) { i = turni - 16; } else if(8 < parseInt(turni)) { i = turni - 8; } else { i = turni; } $('.turntable').css('border-color', '#0374D5'); $('.t-' + i).css('border-color', 'red'); //alert(i); if(turni > 16 && turni == (result + 16)) { pkalert(tiptext, '结果'); $('#turntablebtn').css('display', ''); clearInterval(turn); } turni++; }, 200); } else if(result == 9) { $('#turntablebtn').css('display', ''); tiptext = '请登录后再操作'; } else if(result == 10) { $('#turntablebtn').css('display', ''); tiptext = '应用设置有误,请联系管理员'; } else if(result == 11) { $('#turntablebtn').css('display', ''); tiptext = '您的账户余额不足'; } else { $('#turntablebtn').css('display', ''); tiptext = '数据异常,请稍后再试'; } if(result > 8 || result < 1) { pkalert(tiptext, '结果'); } } } } </script>