<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body> <div id="z"></div> <script> //1-100随即数 var sj=Math.ceil(Math.random()*100); if(sj>50){ document.getElementById("z").innerHTML = "三等奖"+sj; }else if(sj>10){ document.getElementById("z").innerHTML = "二等奖"+sj; }else{ document.getElementById("z").innerHTML = "一等奖"+sj; } </script> </body> </html>