<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Math </title> <style> .qiu{ width:25px; height:25px; font-size:20px; font-weight:600; border-radius:50%; background:#ff0000; box-shadow:0 0 10px #000 inset; border:1px solid #000; color:#fff; } </style> <script type="text/javascript"> function shuangSeQiu(){ var a = Math.ceil(Math.random() * 33); var b = Math.ceil(Math.random() * 33); var c = Math.ceil(Math.random() * 33); var d = Math.ceil(Math.random() * 33); var e = Math.ceil(Math.random() * 33); var f = Math.ceil(Math.random() * 33); var x = Math.ceil(Math.random() * 16); document.getElementById('hongqiu1').value = a; document.getElementById('hongqiu2').value = b; document.getElementById('hongqiu3').value = c; document.getElementById('hongqiu4').value = d; document.getElementById('hongqiu5').value = e; document.getElementById('hongqiu6').value = f; document.getElementById('lanqiu').value = x; } </script> </head> <body> <input type="button" value="o" onclick="shuangSeQiu()" /> <input type="text" class="qiu" id="hongqiu1" /> <input type="text" class="qiu" id="hongqiu2" /> <input type="text" class="qiu" id="hongqiu3" /> <input type="text" class="qiu" id="hongqiu4" /> <input type="text" class="qiu" id="hongqiu5" /> <input type="text" class="qiu" id="hongqiu6" /> <input type="text" class="qiu" id="lanqiu" style="background:#0000ff;" /> <!--需要6个红球不能相同,还有代码优化--> </body> </html>
相关分类