-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd-game.html
More file actions
108 lines (108 loc) · 3.99 KB
/
Copy pathd-game.html
File metadata and controls
108 lines (108 loc) · 3.99 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
th,td{
background-color: #96D4D4;
}
table,td,th{
border: 1px solid black;
}
td{
text-align: center;
height: 50px;
font-size: 20px;
}
th{
background-color: #059090;
height: 50px;
font-size: 25px;
}
</style>
</head>
<body>
<table style="width:100%">
<tr>
<th>Name</th>
<th>Action</th>
<th>Output</th>
</tr>
<tr>
<td>Dice</td>
<td><img src="qcBX8Xp8i.gif" width="15%" onclick="Dice()"></td>
<td id="o1"></td>
</tr>
<tr>
<td>OTP</td>
<td><button onclick="Otp()">Click Me</button></td>
<td id="o2"></td>
</tr>
<tr>
<td>Today's Dinner</td>
<td><button onclick="Dinner()">Click Me</button></td>
<td id="o3"></td>
</tr>
<tr>
<td>Rock paper scissors</td>
<td>
<button onclick="rps(1)">Rock</button>
<button onclick="rps(2)">Paper</button>
<button onclick="rps(3)">Scissors</button>
</td>
<td id="o4"></td>
</tr>
<tr>
<td>Today's Quotes</td>
<td><button onclick="Quotes()">Click Me</button></td>
<td id="o5"></td>
</tr>
<tr>
<td>Password Generator</td>
<td><button onclick="password()">Click Me</button></td>
<td id="o6"></td>
</tr>
</table>
<script>
function password(){
let d = Math.floor(Math.random()*(99-10)+1)+10;
let c1 = Math.floor(Math.random()*(122-97+1))+97;
let c2 = Math.floor(Math.random()*(122-97+1))+97;
let c3 = Math.floor(Math.random()*(122-97+1))+97;
let s = Math.floor(Math.random()*(47-33+1))+33;
document.querySelector('#o6').innerText = String.fromCharCode(c1)+String.fromCharCode(s)+d+String.fromCharCode(c2)+String.fromCharCode(c3);
}
function Quotes(){
let menu = ['A rose by any other name would smell as sweet.','All that glitters is not gold.','Eighty percent of success is showing up.','Elementary, my dear Watson.','Go ahead, make my day.','Hell is other people.','Houston, we have a problem.'];
let l = menu.length;
let x = Math.floor(Math.random()*l);
document.querySelector('#o5').innerText = menu[x];
}
function rps(user){
let comp = Math.floor(Math.random()*3)+1;
console.log(comp);
if(user==comp)
document.querySelector('#o4').innerText ="Tie";
else if(user==1&&comp==2 || user==3 && comp == 1 || user == 2 && comp == 3)
document.querySelector('#o4').innerText ='Computer Win'
else
document.querySelector('#o4').innerText = 'User Win';
}
function Dinner(){
let menu = ['Idli','Dhosa','Chole-Bhature','Methi-Paratha','Pasta','Dal-Makhni','Dhokla','Panner-Tikka','Chana-Jilebi','Puri-Subjee','Pani-Puri','Rajma-Chawal','Khadi-Chawal','Fried-Rice'];
let l = menu.length;
let x = Math.floor(Math.random()*l);
document.querySelector('#o3').innerText = menu[x];
}
function Dice(){
let x = Math.floor(Math.random()*6)+1;
document.querySelector('#o1').innerHTML = `<img src='images/${x}.png' width='15%'>`;
}
function Otp(){
let x = Math.floor(Math.random()*(999999-100000))+100000;
document.querySelector('#o2').innerText = x;
}
</script>
</body></html>