-
Notifications
You must be signed in to change notification settings - Fork 0
/
js-events.html
65 lines (58 loc) · 2.56 KB
/
js-events.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
<!-- JavaScript Events -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JavaScript Events</title>
<script>
function bigImg(x) {
x.style.height = "200px";
x.style.width = "200px";
}
function normalImg(x) {
x.style.height = "150px";
x.style.width = "150px";
}
function myFunction(e) {
x = e.clientX;
y = e.clientY;
coor = "Coordinates: (" + x + "," + y + ")";
document.getElementById("demo").innerHTML = coor
}
function clearCoor() {
document.getElementById("demo").innerHTML = "";
}
</script>
</head>
<body style="background-color: slategray">
<h2>JavaScript Events</h2>
<p>▌Nerede olduğunuzu biliyoruz:</p>
<div id="coordiv" style="width:960px;height:100px;border:1px solid;background-color: darkcyan;" onmousemove="myFunction(event)" onmouseout="clearCoor()"></div>
<p id="demo"></p>
<button onclick="alert('Merhaba!')">Selamla</button>
<br>
<br>
<button onclick="document.getElementById('demo').innerHTML=Date()">Saat kaç?</button>
<br>
<br>
<button onclick="document.getElementById('kutu').style.backgroundColor = 'blue';">Renk Değiştir</button>
<div id="kutu" style="background-color:#ffcc44">Sarıdan Maviye</div>
<br>
<br>
<p>▌Sayfayı istediğiniz renge boyayın:</p>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'blue';">Kırmızı</button>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'black';">Mavi</button>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'red';">Sarı</button>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'pink';">Mor</button>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'grey';">Pembe</button>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'magenta';">Yeşil</button>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'yellow';">Gülkurusu</button>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'Green';">Kahverengi</button>
<button onmouseover="document.querySelector('body').style.backgroundColor = 'brown';">Siyah</button>
<br>
<p>▌Büyüyen resim:</p>
<img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="https://via.placeholder.com/150" alt="Placeholder" width="150" height="150">
</body>
</html>