效果图
<html>
<head>
<title>抽奖</title>
<style>
.result {
font-size: 24px;
font-weight: bold;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>网页抽奖</h1>
<button onclick="startLottery()">开始抽奖</button>
<div class="result" id="result"></div>
<script>
function startLottery() {
var prizes = ["一等奖", "二等奖", "三等奖", "参与奖"];
var result = document.getElementById("result");
var randomIndex = Math.floor(Math.random() * prizes.length);
result.innerHTML = "恭喜您获得:" + prizes[randomIndex];
}
</script>
</body>
</html>