这是2-9的随机值
<script>
var s = parseInt(Math.random()*(9-2+1)+2);
setTimeout("location.href='http://www.1111.com/" + s + ".html'",15);
</script>请问怎么改成我要指定的几个数字里随机比如(2、3、8、9)
<script>
var s = parseInt(Math.random()*(9-2+1)+2);
setTimeout("location.href='http://www.1111.com/" + s + ".html'",15);
</script>请问怎么改成我要指定的几个数字里随机比如(2、3、8、9)
<script>
var a = [2,3,8,9];
var s = parseInt(Math.random()*(3-0+1)+0);
setTimeout("location.href='http://www.1111.com/" + a[s] + ".html'",15);
</script>
var a = [2, 3, 8, 9];
var s = parseInt(Math.random()*a.length);
setTimeout("location.href='http://www.1111.com/" + a[s] + ".html'",15);
何止是巧啊,变量赋值都是一样的