-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
52 lines (43 loc) · 1.38 KB
/
example.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
<!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">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<!-- <div >
<button onclick="s()">hello</button></div>
<div > -->
<div id='id' onclick="p()" style="height: 12px;width: 12px;">hello</div>
<div id="show"></div>
<div class="show1"></div>
<audio src="music1.mp3" autoplay="autoplay" loop="loop">hi</audio>
<!-- <button onclick="s()">hello</button></div> -->
</body>
</html>
<script>
// function s(){
// console.log("kjdk");
// document.getElementById('id').disabled = true;
// $("#id").prop('disabled',true);
function p(){
// console.log("kjdkdhbjmnskw");/
var no= generateRandom(1,7);
document.getElementById('show').innerHTML=no;
document.getElementsByClassName("show1").innerHTML=no;
}
function generateRandom(min,max) {
// find diff
let difference = max - min;
// generate random number
let rand = Math.random();
// multiply with difference
rand = Math.floor( rand * difference);
// add with min value
rand = rand + min;
return rand;
}
</script>