-
Notifications
You must be signed in to change notification settings - Fork 0
/
pg6.html
110 lines (97 loc) · 4.45 KB
/
pg6.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/pg6.css" rel="stylesheet" type="text/css" />
<title>Bobing-联机模式</title>
</head>
<body>
<div class="myCanvas">
<img class="bg_image" src="pic/main_pic2.jpg" alt="haha">
<div class="deco_word3">
<span id="msg">Connecting......</span>
</div>
<div class="deco_pic1">
<img src="pic/bowl_pic.png" alt="haha" height="380px" width="377px">
</div>
<div class="deco_pic2">
<img src="pic/player_pic1.gif" alt="haha" height="150px" width="150px">
</div>
<div class="deco_pic9">
<img src="pic/player_pic3.gif" alt="haha" height="150px" width="150px">
</div>
<div class="deco_word1">
<h1>
<font color="black" size="3">玩家1</font>
</h1>
</div>
<div class="deco_word2">
<h1>
<font color="black" size="3">玩家2</font>
</h1>
</div>
<button class="btn567 one shake" id="start" style="left:320px;top:510px;">开始</button>
<button class="btn789 two shake" id="pause" style="left:450px;top:510px;">结束</button>
<div class="output_player1"></div>
<div class="deco_pic3">
<img id="pic1" src="pic/dice_pic1.jpg" alt="haha" height="55px" width="55px">
</div>
<div class="deco_pic4">
<img id="pic2" src="pic/dice_pic2.jpg" alt="haha" height="55px" width="55px">
</div>
<div class="deco_pic5">
<img id="pic3" src="pic/dice_pic3.jpg" alt="haha" height="55px" width="55px">
</div>
<div class="deco_pic6">
<img id="pic4" src="pic/dice_pic4.jpg" alt="haha" height="55px" width="55px">
</div>
<div class="deco_pic7">
<img id="pic5" src="pic/dice_pic5.jpg" alt="haha" height="55px" width="55px">
</div>
<div class="deco_pic8">
<img id="pic6" src="pic/dice_pic6.jpg" alt="haha" height="55px" width="55px">
</div>
<button class="deco_btnall" id="btn1"><img class="btn_img" src="pic/shoes.png"><span class="btn_span">
Exit</span></button>
<span id="text"></span>
<ul id="haha1"></ul>
<div class="hty_word">
<h1>
<marquee hspace="20px">
中秋博饼,起源于福建厦门,由郑成功驻兵时发明,是闽南地区特有的由饼文化外延的一种传统民俗活动。博饼是中秋节时的一种大众娱乐活动,用六粒骰子投掷结果组合来决定参与者的奖品。传统的奖品为大小不同的月饼,共计一会,设状元1个,对堂2个,三红4个,四进8个,二举16个,一秀32个。相传这种游戏可以预测人未来一年内的运气。 在闽南地区,中秋赌饼也已成为一种商业活动和大众游戏。福建人民出版社1985年出版的《福建风物志》记载:在闽南一带,中秋节有“夺状元饼”的习俗。在台湾中部和东部地区的一些城乡以及台湾离岛金门县,还流行中秋博状元饼的习俗。在金门,金城镇吴厝社区发展协会每年庆祝中秋社区联欢晚会,都有博状元饼大赛。
</marquee>
</h1>
</div>
<div class="hty_horn">
<img src="pic/horn_pic.png" height="30px" alt="haha">
</div>
</div>
</body>
<script type="text/javascript" src="js/pg6.js">
</script>
<script>
var btn = document.querySelector("#pause");
var text = document.querySelector("#text");
var x = document.querySelector("#haha1");
var socket = new WebSocket('ws://localhost:5500')
//open:当websocket服务连接成功时触发
socket.addEventListener('open', function() {
alert("连接服务成功了")
})
//主动给websocket服务发送信息
btn.addEventListener('click', function() {
socket.send(outcome)
})
//接收websocket的服务信息
socket.addEventListener('message', function(e) {
var x1 = document.createElement('li');
x1.innerText = e.data;
x.insertBefore(x1, x.children[0]);
});
socket.addEventListener('close', function(e) {
console.log("haha断开连接")
});
</script>
</html>