hhl_project/index.html
2023-12-13 20:39:01 +08:00

49 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>秦始皇餐厅</title>
<style>
body {
background-image: url('asset/pic/startpage.png');
background-repeat: no-repeat;
display: flex;
justify-content: center;
align-items: center;
}
#start-button {
position: absolute;
background-image: url('asset/pic/start.png');
left: 760px;
top: 400px;
width: 256px; /* 按钮的宽度 */
height: 256px; /* 按钮的高度 */
background-color: transparent;
border: none;
cursor: pointer;
background-size: contain;
background-repeat: no-repeat;
}
</style>
</head>
<body>
<button id="start-button" onclick="startGame()"></button>
<script>
function startGame() {
// 定义游戏页面的数组
var gamePages = ['qinshihuanggame.html', 'luoisgame.html'];
// 生成一个随机索引
var randomIndex = Math.floor(Math.random() * gamePages.length);
// 使用随机索引从数组中选择一个游戏页面
var selectedGame = gamePages[randomIndex];
// 跳转到选中的游戏页面
window.location.href = selectedGame;
}
</script>
</body>
</html>