Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7474b73

Browse files
Merge pull request #52 from AzharAli-github/main
Main
2 parents f7969c8 + d4393c0 commit 7474b73

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
h2 {
2+
font-family: monospace;
3+
}
4+
5+
div {
6+
width: 300px;
7+
height: 300px;
8+
border: 1px solid black;
9+
text-align: center;
10+
}
4.15 KB
Loading[フレーム]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>DOM Event Listner</title>
9+
<link rel="stylesheet" href="css/style.css">
10+
<link src = "images/js-logo.png">
11+
</head>
12+
13+
<body>
14+
<h1>DOM Event Listener</h1>
15+
<h2>Example One</h2>
16+
<div id="exampleOne">
17+
<h2>OnClict Event</h2>
18+
</div>
19+
<h2>Example Two</h2>
20+
<div id="exampleTwo">
21+
<h2>On Mouse Over</h2>
22+
</div>
23+
<h2>Example Three</h2>
24+
<div id="exampleThree">
25+
<h2>On Mouse Out</h2>
26+
</div>
27+
<script src="script.js"></script>
28+
</body>
29+
30+
</html>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Example One
2+
let exampleOne = document.getElementById('exampleOne');
3+
4+
exampleOne.addEventListener("click", () => {
5+
exampleOne.style.backgroundColor = "Green";
6+
exampleOne.style.color = "white";
7+
});
8+
9+
10+
// Example Two
11+
let exampleTwo = document.getElementById('exampleTwo');
12+
13+
exampleTwo.addEventListener("mouseover", () => {
14+
exampleTwo.style.backgroundColor = "Blue";
15+
exampleTwo.style.color = "White";
16+
});
17+
exampleTwo.addEventListener("mouseout", () => {
18+
exampleTwo.style.backgroundColor = "white";
19+
exampleTwo.style.color = "Green"
20+
});
21+
22+
// Example Three
23+
24+
let exampleThree = document.getElementById('exampleThree');
25+
26+
exampleThree.addEventListener("mouseover", () => {
27+
exampleThree.style.backgroundColor = "purple";
28+
exampleThree.style.Color = "white";
29+
})
30+
31+
exampleThree.addEventListener("mouseout", () => {
32+
exampleThree.style.backgroundColor = "white";
33+
exampleThree.style.color = "purple";
34+
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /