<html> <head> <script>
function getRed(){ var arr = new Array; var red = new Array; for(var v=1; v<34; v++){ arr[v-1]=v; } for(var v=0; v<6;v++){ var index = Math.floor(Math.random()*(33-v)); red[v]=arr[index]; arr[index]=arr[32-v]; } return red; }
function getBlue(){ return (Math.ceil(Math.random()*16)); }
function f1(){ var red=getRed(); red.sort(function(a,b){return a-b;}); document.getElementById('div1').innerHTML="红球:"+red; var blue=getBlue(); document.getElementById('div2').innerHTML="蓝色:"+blue; }
</script>
</head> <body> <input type="button" value="机选一注" onclick="f1()"/> <div id="div1" style="color:red;font-size:30px;">红球:</div>
<div id="div2" style="color:blue;font-size:30px;">篮球:</div>
<br/> <a href=URL target=aa>
</body> </html>