-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.html
More file actions
73 lines (56 loc) · 2.25 KB
/
test2.html
File metadata and controls
73 lines (56 loc) · 2.25 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var playerscore = 0;
var dealerscore = 0;
function endRound() {
var i, d, p, tmp;
// Enable/disable buttons.
document.forms["controls"].elements["deal"].disabled = false;
EnableBetButtons();
DisablePlayButtons();
// Fix for IE 6 rendering bug.
if (navigator.userAgent.indexOf("MSIE 6") >= 0) {
dealer.cardsNode.firstChild.style.backgroundImage = "none";
dealer.cardsNode.firstChild.style.backgroundColor = "white";
}
// Show the dealer's down card and score.
dealer.cardsNode.firstChild.firstChild.style.visibility = "";
d = dealer.getScore();
if (!dealer.blackjack && d <= 21)
dealer.scoreTextNode.nodeValue = d;
// Show result of each player hand and pay it off, if appropriate.
for (i = 0; i < numPlayerHands; i++) {
p = player[i].getScore();
if (player[i].surrender) {
player[i].resultTextNode.nodeValue = "Player Surrendered";
player[i].bet /= 2;
credits += player[i].bet;
}
else if ((player[i].blackjack && !dealer.blackjack) ||
(p <= 21 && d > 21) || (p <= 21 && p > d)) {
player[i].resultTextNode.nodeValue = "Player Wins";
tmp = 2 * player[i].bet;
// Blackjack pays 3 to 2.
if (player[i].blackjack)
tmp += player[i].bet / 2;
player[i].bet = tmp;
credits += player[i].bet;
}
else if ((dealer.blackjack && !player[i].blackjack) ||
p > 21 || p < d) {
player[i].resultTextNode.nodeValue = "Player Loses";
addClassName(player[i].betTextNode.parentNode, "lost");
}
updateBetDisplay(i);
}
}
</script>
</body>
</html>